Commit 0370cedc authored by romanb's avatar romanb

Fixed #966.

parent 66fb71ac
...@@ -1080,6 +1080,9 @@ final class Doctrine ...@@ -1080,6 +1080,9 @@ final class Doctrine
return true; return true;
} }
/* TODO: Move the following code out of here. A generic Doctrine_Autoloader
class that can be configured in various ways might be a good idea.
Same goes for locate().*/
$loadedModels = self::$_loadedModelFiles; $loadedModels = self::$_loadedModelFiles;
if (isset($loadedModels[$className]) && file_exists($loadedModels[$className])) { if (isset($loadedModels[$className]) && file_exists($loadedModels[$className])) {
......
...@@ -94,7 +94,10 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract ...@@ -94,7 +94,10 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
$prev = array(); $prev = array();
// holds the values of the identifier/primary key fields of components, // holds the values of the identifier/primary key fields of components,
// separated by a pipe '|' and grouped by component alias (r, u, i, ... whatever) // separated by a pipe '|' and grouped by component alias (r, u, i, ... whatever)
// the $idTemplate is a prepared template. $id is set to a fresh template when
// starting to process a row.
$id = array(); $id = array();
$idTemplate = array();
// Holds the resulting hydrated data structure // Holds the resulting hydrated data structure
$result = $driver->getElementCollection($rootComponentName); $result = $driver->getElementCollection($rootComponentName);
...@@ -111,12 +114,13 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract ...@@ -111,12 +114,13 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
$listeners[$componentName] = $component['table']->getRecordListener(); $listeners[$componentName] = $component['table']->getRecordListener();
$identifierMap[$dqlAlias] = array(); $identifierMap[$dqlAlias] = array();
$prev[$dqlAlias] = array(); $prev[$dqlAlias] = array();
$id[$dqlAlias] = ''; $idTemplate[$dqlAlias] = '';
} }
// Process result set // Process result set
$cache = array(); $cache = array();
while ($data = $stmt->fetch(Doctrine::FETCH_ASSOC)) { while ($data = $stmt->fetch(Doctrine::FETCH_ASSOC)) {
$id = $idTemplate; // initialize the id-memory
$nonemptyComponents = array(); $nonemptyComponents = array();
$rowData = $this->_gatherRowData($data, $cache, $id, $nonemptyComponents); $rowData = $this->_gatherRowData($data, $cache, $id, $nonemptyComponents);
...@@ -233,9 +237,7 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract ...@@ -233,9 +237,7 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
} }
$coll =& $prev[$parent][$relationAlias]; $coll =& $prev[$parent][$relationAlias];
$this->_setLastElement($prev, $coll, $index, $dqlAlias, $oneToOne); $this->_setLastElement($prev, $coll, $index, $dqlAlias, $oneToOne);
$id[$dqlAlias] = '';
} }
$id[$rootAlias] = '';
} }
$stmt->closeCursor(); $stmt->closeCursor();
......
This diff is collapsed.
...@@ -71,8 +71,5 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase ...@@ -71,8 +71,5 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
$this->assertEquals(2, $objectResult[1]->id); $this->assertEquals(2, $objectResult[1]->id);
$this->assertEquals('jwage', $objectResult[1]->name); $this->assertEquals('jwage', $objectResult[1]->name);
//Doctrine::dump($res);
$this->assertEquals(0, 0);
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment