moveNode() public méthode

WRITE: move node from source path to destination path
See also: Session::move()
public moveNode ( string $srcAbsPath, string $destAbsPath )
$srcAbsPath string Absolute path to the source node.
$destAbsPath string Absolute path to the destination where the node shall be moved to.
Exemple #1
0
 /**
  * {@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);
 }