diff --git a/lib/Doctrine/Hydrate.php b/lib/Doctrine/Hydrate.php index d4561300b..29e14ec7e 100644 --- a/lib/Doctrine/Hydrate.php +++ b/lib/Doctrine/Hydrate.php @@ -398,8 +398,12 @@ class Doctrine_Hydrate reset($this->_aliasMap); $rootMap = current($this->_aliasMap); $rootAlias = key($this->_aliasMap); - $coll = new Doctrine_Collection2($rootMap['table']); + $coll = new Doctrine_Collection($rootMap['table']); $prev[$rootAlias] = $coll; + + // we keep track of all the collections + $colls = array(); + $colls[] = $coll; $prevRow = array(); /** @@ -471,6 +475,9 @@ class Doctrine_Hydrate // previous entry found from memory $prev[$alias] = $prev[$parentAlias]->getLast()->get($relation->getAlias()); } + + $colls[] = $prev[$alias]; + // add record to the current collection if ($identifiable) { $prev[$alias]->add($record); @@ -491,6 +498,11 @@ class Doctrine_Hydrate $prevRow[$tableAlias] = $row; } } + // take snapshots from all initialized collections + foreach(array_unique($colls) as $coll) { + $coll->takeSnapshot(); + } + return $coll; } /** diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index 070dd9b03..e6573608a 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -30,7 +30,7 @@ Doctrine::autoload('Doctrine_Hydrate'); * @version $Revision$ * @author Konsta Vesterinen */ -class Doctrine_Query extends Doctrine_Hydrate2 implements Countable +class Doctrine_Query extends Doctrine_Hydrate implements Countable { /** * @param array $subqueryAliases the table aliases needed in some LIMIT subqueries