/**
* 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();
}