public function getNode($path)
{
$this->assertLoggedIn();
PathHelper::assertValidAbsolutePath($path, false, true, $this->getNamespacePrefixes());
$values[':path'] = $path;
$values[':pathd'] = rtrim($path, '/') . '/%';
$values[':workspace'] = $this->workspaceName;
if ($this->fetchDepth > 0) {
$values[':fetchDepth'] = $this->fetchDepth;
$query = '
SELECT * FROM phpcr_nodes
WHERE (path LIKE :pathd OR path = :path)
AND workspace_name = :workspace
AND depth <= ((SELECT depth FROM phpcr_nodes WHERE path = :path AND workspace_name = :workspace) + :fetchDepth)
ORDER BY depth, sort_order ASC';
} else {
$query = '
SELECT * FROM phpcr_nodes
WHERE path = :path
AND workspace_name = :workspace
ORDER BY depth, sort_order ASC';
}
$stmt = $this->getConnection()->executeQuery($query, $values);
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
if (empty($rows)) {
throw new ItemNotFoundException("Item {$path} not found in workspace " . $this->workspaceName);
}
$nestedNodes = $this->getNodesData($rows);
$node = array_shift($nestedNodes);
foreach ($nestedNodes as $nestedPath => $nested) {
$relativePath = PathHelper::relativizePath($nestedPath, $path);
$this->nestNode($node, $nested, explode('/', $relativePath));
}
return $node;
}