Neos\ContentRepository\Domain\Model\Node::setPath PHP Method

setPath() protected method

This method is only for internal use by the content repository or node methods. Changing the path of a node manually may lead to unexpected behavior. To achieve a correct behavior when changing the path (moving the node) in a workspace, a shadow node data that will hide the node data in the base workspace will be created. Thus queries do not need to worry about moved nodes. Through a movedTo reference the shadow node data will be removed when publishing the moved node.
protected setPath ( string $path, boolean $checkForExistence = true ) : void
$path string
$checkForExistence boolean Checks for existence at target path, internally used for recursions and shadow nodes.
return void
    protected function setPath($path, $checkForExistence = true)
    {
        $originalPath = $this->nodeData->getPath();
        if ($originalPath === $path) {
            return;
        }
        $pathAvailable = $checkForExistence ? $this->isNodePathAvailable($path) : true;
        if (!$pathAvailable) {
            throw new NodeException(sprintf('Can not rename the node "%s" as a node already exists on path "%s"', $this->getPath(), $path), 1414436551);
        }
        $changedNodePathsCollection = $this->setPathInternal($path, !$checkForExistence);
        $this->nodeDataRepository->persistEntities();
        array_walk($changedNodePathsCollection, function ($changedNodePathInformation) {
            call_user_func_array([$this, 'emitNodePathChanged'], $changedNodePathInformation);
        });
    }
Node