getNodeByPath() публичный Метод

To prevent unnecessary work to be done a cache is filled to only fetch nodes once. To reset a node with the data from the backend, use Node::refresh() Uses the factory to create a Node object.
См. также: Session::getNode()
public getNodeByPath ( string $absPath, string $class = 'Node', object $object = null ) : PHPCR\NodeInterface
$absPath string The absolute path of the node to fetch.
$class string The class of node to get. TODO: Is it sane to fetch data separately for Version and normal Node?
$object object A (prefetched) object (de-serialized json) from the backend only to be used if we get child nodes in one backend call
Результат PHPCR\NodeInterface
Пример #1
0
 public function current()
 {
     $path = $this->key();
     if (!isset($path)) {
         return null;
     }
     return $this->objectmanager->getNodeByPath($path);
 }
Пример #2
0
 /**
  * {@inheritDoc}
  *
  * @api
  */
 public function getNode($selectorName = null)
 {
     $path = $this->getPath($selectorName);
     if (!$path) {
         // handle outer joins
         return null;
     }
     return $this->objectmanager->getNodeByPath($this->getPath($selectorName));
 }
Пример #3
0
 /**
  * {@inheritDoc}
  *
  * @api
  */
 public function getBaseVersion($absPath)
 {
     $node = $this->objectManager->getNodeByPath($absPath);
     try {
         //TODO: could check if node has versionable mixin type
         $uuid = $node->getProperty('jcr:baseVersion')->getString();
     } catch (PathNotFoundException $e) {
         throw new UnsupportedRepositoryOperationException("No jcr:baseVersion version for {$absPath}");
     }
     return $this->objectManager->getNodeByIdentifier($uuid, 'Version\\Version');
 }
Пример #4
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);
 }
Пример #5
0
 /**
  * {@inheritDoc}
  *
  * @api
  */
 public function getNode($selectorName = null)
 {
     return $this->objectmanager->getNodeByPath($this->getPath($selectorName));
 }