Skip to content
Browse files

Merge pull request #122 from petesiss/ordering-fix

Ordering fix
  • Loading branch information...
2 parents 001940b + 6bd6de1 commit 54a2a440ecbe4cb7d9710f339c0bcccff06731bc @dbu dbu committed Jun 18, 2012
Showing with 14 additions and 4 deletions.
  1. +14 −4 src/Jackalope/ObjectManager.php
View
18 src/Jackalope/ObjectManager.php
@@ -263,17 +263,27 @@ public function getNodesByPath($paths, $class = 'Node')
// Return it from memory if we already have it
$nodes[$absPath] = $this->objectsByPath[$class][$absPath];
} else {
+ $nodes[$absPath] = '';
$fetchPaths[$absPath] = $this->getFetchPath($absPath, $class);
}
}
if (!empty($fetchPaths)) {
- $data = $this->transport->getNodes($fetchPaths, $class);
+ $data = $this->transport->getNodes($fetchPaths);
+ $dataItems = array();
+
foreach ($data as $fetchPath => $item) {
- $absPath = array_search($fetchPath, $fetchPaths);
- $nodes[$absPath] = $this->getNodeByPath($absPath, $class, $item);
+ $dataItems[$fetchPath] = $item;
}
- }
+
+ foreach ($fetchPaths as $absPath => $fetchPath) {
+ if (array_key_exists($fetchPath, $dataItems)) {
+ $nodes[$absPath] = $this->getNodeByPath($absPath, $class, $dataItems[$fetchPath]);
+ } else {
+ unset($nodes[$fetchPath]);
+ }
+ }
+ }
return new ArrayIterator($nodes);
}

0 comments on commit 54a2a44

Please sign in to comment.
Something went wrong with that request. Please try again.