If the node does not exist in the specified context's workspace, this function will
try to find one with the given path in one of the base workspaces (if any).
Examples for valid paths:
the root node
foo node "foo" on the first level
foo/bar node "bar" on the second level
foo/ first node on second level, below "foo"
public findOneByPathInContext ( string $path, |
||
$path | string | Absolute path of the node |
$context | The containing context | |
return | Neos\ContentRepository\Domain\Model\NodeInterface | null | The matching node if found, otherwise NULL |
/** * Returns a node specified by the given relative path. * * @param string $path Path specifying the node, relative to this node * @return NodeInterface The specified node or NULL if no such node exists * @api */ public function getNode($path) { $absolutePath = $this->nodeService->normalizePath($path, $this->getPath()); $node = $this->context->getFirstLevelNodeCache()->getByPath($absolutePath); if ($node !== false) { return $node; } $node = $this->nodeDataRepository->findOneByPathInContext($absolutePath, $this->context); $this->context->getFirstLevelNodeCache()->setByPath($absolutePath, $node); return $node; }