setPath() public method

Sets the absolute path of this node
public setPath ( string $path, boolean $recursive = true ) : void
$path string
$recursive boolean
return void
コード例 #1
0
 /**
  * Adjusts the path of $shadowNodeData to $path, if needed/possible.
  *
  * If the $path is occupied in $targetWorkspace, the shadow is removed.
  *
  * @param NodeData $shadowNodeData
  * @param $path
  * @param Workspace $targetWorkspace
  * @param array $dimensionValues
  * @return void
  */
 protected function adjustShadowNodePath(NodeData $shadowNodeData, $path, Workspace $targetWorkspace, array $dimensionValues)
 {
     $nodeOnSamePathInTargetWorkspace = $this->nodeDataRepository->findOneByPath($path, $targetWorkspace, $dimensionValues);
     if ($nodeOnSamePathInTargetWorkspace === null || $nodeOnSamePathInTargetWorkspace->getWorkspace() !== $targetWorkspace) {
         $shadowNodeData->setPath($path, false);
         return;
     }
     // A node exists in that path, so no shadow node is needed/possible.
     $this->nodeDataRepository->remove($shadowNodeData);
 }
コード例 #2
0
 /**
  * Renames the node to the new name.
  *
  * @param NodeData $node
  * @return void
  */
 public function execute(NodeData $node)
 {
     $newNodePath = $node->getParentPath() . '/' . $this->newName;
     $node->setPath($newNodePath);
 }