public function moveNode($srcAbsPath, $destAbsPath)
{
if (!$this->transport instanceof WritingInterface) {
throw new UnsupportedRepositoryOperationException('Transport does not support writing');
}
$srcAbsPath = PathHelper::normalizePath($srcAbsPath);
$destAbsPath = PathHelper::normalizePath($destAbsPath, true);
$this->rewriteItemPaths($srcAbsPath, $destAbsPath, true);
// record every single move in case we have intermediary operations
$operation = new MoveNodeOperation($srcAbsPath, $destAbsPath);
$this->operationsLog[] = $operation;
// update local cache state information
if ($original = $this->getMoveSrcPath($srcAbsPath)) {
$srcAbsPath = $original;
}
$this->nodesMove[$srcAbsPath] = $operation;
}
/** * {@inheritDoc} * * @api */ public function move($srcAbsPath, $destAbsPath) { try { $parent = $this->objectManager->getNodeByPath(PathHelper::getParentPath($destAbsPath)); } catch (ItemNotFoundException $e) { throw new PathNotFoundException("Target path can not be found: {$destAbsPath}", $e->getCode(), $e); } if ($parent->hasNode(PathHelper::getNodeName($destAbsPath))) { // TODO same-name siblings throw new ItemExistsException('Target node already exists at ' . $destAbsPath); } if ($parent->hasProperty(PathHelper::getNodeName($destAbsPath))) { throw new ItemExistsException('Target property already exists at ' . $destAbsPath); } $this->objectManager->moveNode($srcAbsPath, $destAbsPath); }