getNode() public method

If you have an absolute path use {@link getNodeByPath()} for better performance.
See also: Session::getNode()
public getNode ( string $relPath, string $context, string $class = 'Node' ) : PHPCR\NodeInterface
$relPath string relative path
$context string context path
$class string optional class name for the factory
return PHPCR\NodeInterface The specified Node. if not available, ItemNotFoundException is thrown
Exemplo n.º 1
0
 public function current()
 {
     $path = $this->key();
     if (!isset($path)) {
         return null;
     }
     return $this->objectmanager->getNode($path);
 }
Exemplo n.º 2
0
 /**
  * {@inheritDoc}
  *
  * @api
  */
 public function restore($removeExisting, $version, $absPath = null)
 {
     if ($this->objectManager->hasPendingChanges()) {
         throw new InvalidItemStateException('You may not call restore when there pending unsaved changes');
     }
     if (is_string($version)) {
         if (!is_string($absPath)) {
             throw new \InvalidArgumentException('To restore version by version name you need to specify the path to the node you want to restore to this name');
         }
         $vh = $this->getVersionHistory($absPath);
         $version = $vh->getVersion($version);
         $versionPath = $version->getPath();
         $nodePath = $absPath;
     } elseif (is_array($version)) {
         // @codeCoverageIgnoreStart
         throw new NotImplementedException('TODO: implement restoring a list of versions');
         // @codeCoverageIgnoreEnd
     } elseif ($version instanceof VersionInterface && is_string($absPath)) {
         // @codeCoverageIgnoreStart
         throw new NotImplementedException('TODO: implement restoring a version to a specified path');
         // @codeCoverageIgnoreEnd
     } elseif ($version instanceof VersionInterface) {
         $versionPath = $version->getPath();
         $nodePath = $this->objectManager->getNode($version->getContainingHistory()->getVersionableIdentifier())->getPath();
     } else {
         throw new \InvalidArgumentException();
     }
     $this->objectManager->restore($removeExisting, $versionPath, $nodePath);
     $version->setCachedPredecessorsDirty();
     if ($history = $this->objectManager->getCachedNode(dirname($version->getPath()), 'Version\\VersionHistory')) {
         $history->notifyHistoryChanged();
     }
 }
Exemplo n.º 3
0
 /**
  * {@inheritDoc}
  *
  * @api
  */
 public function getNode($selectorName = null)
 {
     return $this->objectmanager->getNode($this->getPath($selectorName));
 }
Exemplo n.º 4
0
 /**
  * {@inheritDoc}
  *
  * @api
  */
 public function getNodeByIdentifier($id)
 {
     return $this->objectManager->getNode($id);
 }