public addChildNode ( PHPCR\NodeInterface $node, boolean $check, string $name = null ) | ||
$node | PHPCR\NodeInterface | The name of the child node |
$check | boolean | whether to check state |
$name | string | is used in cases where $node->getName would not return the correct name (during move operation) |
public function addChildNode(NodeInterface $node, $check, $name = null)
{
if ($check) {
$this->checkState();
}
if (is_null($name)) {
$name = $node->getName();
}
$nt = $this->getPrimaryNodeType();
//will throw a ConstraintViolationException if this node can't be added
$nt->canAddChildNode($name, $node->getPrimaryNodeType()->getName(), true);
// TODO: same name siblings
$this->nodes[] = $name;
if (null !== $this->originalNodesOrder) {
$this->originalNodesOrder[] = $name;
}
}