Skip to content

Commit

Permalink
fixed ObjectManager::remove invocation
Browse files Browse the repository at this point in the history
deny removal of root node
  • Loading branch information
rndstr committed Sep 21, 2010
1 parent 172a99d commit 4464f53
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/jackalope/Item.php
Expand Up @@ -293,9 +293,15 @@ public function refresh($keepChanges) {
* @api
*/
public function remove() {
// sanity checks
if ($this->getDepth() == 0) {
throw new PHPCR_RepositoryException('Cannot remove root node');
}

//TODO: add sanity checks to all other write methods to avoid modification after deleting?
//FIXME: property remove different or same call on objectmanager?
$this->objectManager->removeNode($path);
// TODO same-name siblings reindexing
$this->objectManager->removeItem($this->path);
$this->getParent()->setModified();
}

Expand Down

0 comments on commit 4464f53

Please sign in to comment.