public function getNodesByIdentifier($identifiers, $class = 'Node')
{
$nodes = $fetchPaths = array();
foreach ($identifiers as $uuid) {
if (!empty($this->objectsByUuid[$uuid]) && !empty($this->objectsByPath[$class][$this->objectsByUuid[$uuid]])) {
// Return it from memory if we already have it
$nodes[$uuid] = $this->objectsByPath[$class][$this->objectsByUuid[$uuid]];
} else {
$fetchPaths[$uuid] = $uuid;
$nodes[$uuid] = $uuid;
// keep position
}
}
if (!empty($fetchPaths)) {
$data = $this->transport->getNodesByIdentifier($fetchPaths);
foreach ($data as $absPath => $item) {
// TODO: $absPath is the backend path. we should inverse the getFetchPath operation here
// build the node from the received data
$node = $this->getNodeByPath($absPath, $class, $item);
$found[$node->getIdentifier()] = $node;
}
foreach ($nodes as $key => $node) {
if (is_string($node)) {
if (isset($found[$node])) {
$nodes[$key] = $found[$node];
} else {
unset($nodes[$key]);
}
}
}
}
reset($nodes);
return new ArrayIterator($nodes);
}