/** * Remove this node * * {@inheritDoc} * * A jackalope node needs to notify the parent node about this if it is * cached, in addition to \PHPCR\ItemInterface::remove() * * @uses Node::unsetChildNode() * * @api */ public function remove() { $this->checkState(); $parent = $this->getParent(); $parentNodeType = $parent->getPrimaryNodeType(); //will throw a ConstraintViolationException if this node can't be removed $parentNodeType->canRemoveNode($this->getName(), true); if ($parent) { $parent->unsetChildNode($this->name, true); } // once we removed ourselves, $this->getParent() won't work anymore. do this last parent::remove(); }
/** * Also unsets internal reference in containing node * * {@inheritDoc} * * @return void * * @uses Node::unsetProperty() * * @api */ public function remove() { $this->checkState(); $parentNodeType = $this->getParent()->getPrimaryNodeType(); //will throw a ConstraintViolationException if this property can't be removed $parentNodeType->canRemoveProperty($this->getName(), true); $this->getParent()->unsetProperty($this->name); parent::remove(); }
/** * This is necessary to remove the internal reference in the parent node * * {@inheritDoc} * * @return void * @uses unsetChildNode() * @api **/ public function remove() { parent::remove(); $this->getParent()->unsetChildNode($this->name); }