public function getNodesByIdentifier($identifiers)
{
$this->assertLoggedIn();
if (empty($identifiers)) {
return array();
}
$query = 'SELECT id, path, parent, local_name, namespace, workspace_name, identifier, type, props, depth, sort_order
FROM phpcr_nodes WHERE workspace_name = ? AND identifier IN (?)';
if ($this->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) {
$all = array();
foreach (array_chunk($identifiers, self::SQLITE_MAXIMUM_IN_PARAM_COUNT) as $chunk) {
$all += $this->getConnection()->fetchAll($query, array($this->workspaceName, $chunk), array(\PDO::PARAM_STR, Connection::PARAM_STR_ARRAY));
}
} else {
$all = $this->getConnection()->fetchAll($query, array($this->workspaceName, $identifiers), array(\PDO::PARAM_STR, Connection::PARAM_STR_ARRAY));
}
$nodes = array();
if ($all) {
$nodesData = $this->getNodesData($all);
// ensure that the nodes are returned in the order if how the identifiers were passed in
$pathByUuid = array();
foreach ($nodesData as $path => $node) {
$pathByUuid[$node->{'jcr:uuid'}] = $path;
}
foreach ($identifiers as $identifier) {
if (isset($pathByUuid[$identifier])) {
$nodes[$pathByUuid[$identifier]] = $nodesData[$pathByUuid[$identifier]];
}
}
}
return $nodes;
}