/** * Sets the absolute path of this node. * * This method is only for internal use by the content repository. Changing * the path of a node manually may lead to unexpected behavior. * * @param string $path * @param boolean $recursive * @return void */ public function setPath($path, $recursive = TRUE) { if ($this->nodeData->getPath() === $path) { return; } if ($recursive === TRUE) { /** @var $childNode NodeInterface */ foreach ($this->getChildNodes() as $childNode) { $childNode->setPath($path . '/' . $childNode->getNodeData()->getName(), TRUE); } } if (!$this->isNodeDataMatchingContext()) { $this->materializeNodeData(); } $this->nodeData->setPath($path, FALSE); $this->context->getFirstLevelNodeCache()->flush(); }
/** * 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); }
/** * 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); }
/** * Renames the node to the new name. * * @param \TYPO3\TYPO3CR\Domain\Model\NodeData $node * @return void */ public function execute(\TYPO3\TYPO3CR\Domain\Model\NodeData $node) { $newNodePath = $node->getParentPath() . '/' . $this->newName; $node->setPath($newNodePath); }