/** * 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 NodeData $node * @return void */ public function execute(NodeData $node) { $newNodePath = $node->getParentPath() . '/' . $this->newName; $node->setPath($newNodePath); }