1
0
Fork 0
mirror of synced 2025-04-03 13:23:37 +03:00
This commit is contained in:
zYne 2007-05-29 18:33:22 +00:00
parent 063d0f876d
commit 1b891324c9

View file

@ -834,9 +834,11 @@ class Doctrine_Hydrate implements Serializable
if ( ! isset($currData[$alias])) { if ( ! isset($currData[$alias])) {
$currData[$alias] = array(); $currData[$alias] = array();
} }
if ( ! isset($prev[$alias])) { if ( ! isset($prev[$alias])) {
$prev[$alias] = array(); $prev[$alias] = array();
} }
if ($alias !== $lastAlias || $parse) { if ($alias !== $lastAlias || $parse) {
// component changed // component changed
@ -849,6 +851,7 @@ class Doctrine_Hydrate implements Serializable
$array[$index] = $driver->getElement($currData[$alias], $componentName); $array[$index] = $driver->getElement($currData[$alias], $componentName);
$prev[$alias] =& $array[$index]; $prev[$alias] =& $array[$index];
$index++; $index++;
} }
} }
@ -857,11 +860,16 @@ class Doctrine_Hydrate implements Serializable
$relation = $this->_aliasMap[$cache[$key]['alias']]['relation']; $relation = $this->_aliasMap[$cache[$key]['alias']]['relation'];
if ( ! isset($prevData[$alias]) || $currData[$alias] !== $prevData[$alias]) { if ( ! isset($prevData[$alias]) || $currData[$alias] !== $prevData[$alias]) {
// check the type of the relation if ( ! empty($currData[$alias])) {
if ( ! $relation->isOneToOne()) { // check the type of the relation
$prev[$parent][$component][] = $driver->getElement($currData[$alias], $componentName); if ( ! $relation->isOneToOne()) {
} else {
$prev[$parent][$component] = $driver->getElement($currData[$alias], $componentName); $prev[$parent][$component][] = $driver->getElement($currData[$alias], $componentName);
$driver->registerCollection($prev[$parent][$component]);
} else {
$prev[$parent][$component] = $driver->getElement($currData[$alias], $componentName);
}
} }
} }
} }
@ -905,6 +913,7 @@ class Doctrine_Hydrate implements Serializable
// check the type of the relation // check the type of the relation
if ( ! $relation->isOneToOne()) { if ( ! $relation->isOneToOne()) {
$prev[$parent][$component][] = $driver->getElement($currData[$alias], $componentName); $prev[$parent][$component][] = $driver->getElement($currData[$alias], $componentName);
$driver->registerCollection($prev[$parent][$component]);
} else { } else {
$prev[$parent][$component] = $driver->getElement($currData[$alias], $componentName); $prev[$parent][$component] = $driver->getElement($currData[$alias], $componentName);
} }