/**
  * Move the document with the given path or ID to the path
  * of the destination document (as a child).
  *
  * @param string $srcId
  * @param string $destId
  * @param string $name
  */
 public function move($srcId, $destId, $name)
 {
     $srcPath = $this->normalizeToPath($srcId);
     $parentDestPath = $this->normalizeToPath($destId);
     $destPath = $parentDestPath . '/' . $name;
     $this->session->move($srcPath, $destPath);
 }
 private function doMoveNodes(array $nodes, $sourceQuery, $targetPath)
 {
     if (false === $this->isGlobbed($sourceQuery)) {
         return $this->session->move(current($nodes)->getPath(), $targetPath);
     }
     foreach ($nodes as $node) {
         $this->session->move($node->getPath(), $targetPath . '/' . $node->getName());
     }
 }
 /**
  * Produce the following entries at the end of the event journal:.
  *
  *      PROPERTY_ADDED      /child/jcr:primaryType
  *      NODE_ADDED          /child
  *      PERSIST
  *      PROPERTY_ADDED      /child/prop
  *      PERSIST
  *      PROPERTY_CHANGED    /child/prop
  *      PERSIST
  *      PROPERTY_REMOVED    /child/prop
  *      PERSIST
  *      NODE_REMOVED        /child
  *      PERSIST
  *
  * WARNING:
  * If you change the events (or the order of events) produced here, you
  * will have to adapt self::expectEvents so that it checks for the correct
  * events.
  *
  * @param $session
  */
 protected function produceEvents(SessionInterface $session)
 {
     $parent = $session->getNode($this->nodePath);
     // Will cause a PROPERTY_ADDED + a NODE_ADDED events
     $node = $parent->addNode('child');
     // Will cause a PERSIST event
     $session->save();
     // Will case a PROPERTY_ADDED event
     $prop = $node->setProperty('prop', 'value');
     // Will cause a PERSIST event
     $session->save();
     // Will cause a PROPERTY_CHANGED event
     $prop->setValue('something else');
     // Will cause a PERSIST event
     $session->save();
     // Will cause a PROPERTY_REMOVED event
     $prop->remove();
     // Will cause a PERSIST event
     $session->save();
     // Will cause a NODE_REMOVED + NODE_ADDED + NODE_MOVED events
     $session->move($node->getPath(), $this->nodePath . '/moved');
     // Will cause a PERSIST event
     $session->save();
     // Will cause a NODE_REMOVED event
     $node->remove();
     // Will cause a PERSIST event
     $session->save();
 }