Commit a0a9df9b authored by zYne's avatar zYne

--no commit message

--no commit message
parent 4d0310bf
...@@ -803,23 +803,20 @@ class Doctrine_Hydrate implements Serializable ...@@ -803,23 +803,20 @@ class Doctrine_Hydrate implements Serializable
if ( ! isset($cache[$key])) { if ( ! isset($cache[$key])) {
$e = explode('__', $key); $e = explode('__', $key);
$cache[$key]['field'] = $field = strtolower(array_pop($e)); $cache[$key]['field'] = $field = strtolower(array_pop($e));
$componentAlias = $this->_tableAliases[strtolower(implode('__', $e))]; $cache[$key]['alias'] = $this->_tableAliases[strtolower(implode('__', $e))];
$cache[$key]['alias'] = $componentAlias;
if (isset($this->_aliasMap[$componentAlias]['relation'])) {
$cache[$key]['component'] = $this->_aliasMap[$componentAlias]['relation']->getAlias();
$cache[$key]['parent'] = $this->_aliasMap[$componentAlias]['parent'];
} else {
$cache[$key]['component'] = $this->_aliasMap[$componentAlias]['table']->getComponentName();
} }
}
$map = $this->_aliasMap[$cache[$key]['alias']];
$table = $map['table'];
$alias = $cache[$key]['alias']; $alias = $cache[$key]['alias'];
$component = $cache[$key]['component'];
$componentName = $this->_aliasMap[$cache[$key]['alias']]['table']->getComponentName(); $componentName = $map['table']->getComponentName();
$table = $this->_aliasMap[$cache[$key]['alias']]['table']; if (isset($map['relation'])) {
$componentAlias = $map['relation']->getAlias();
} else {
$componentAlias = $map['table']->getComponentName();
}
if ( ! isset($currData[$alias])) { if ( ! isset($currData[$alias])) {
...@@ -850,29 +847,29 @@ class Doctrine_Hydrate implements Serializable ...@@ -850,29 +847,29 @@ class Doctrine_Hydrate implements Serializable
$coll =& $array; $coll =& $array;
} else { } else {
$parent = $cache[$key]['parent']; $parent = $map['parent'];
$relation = $this->_aliasMap[$cache[$key]['alias']]['relation']; $relation = $map['relation'];
// check the type of the relation // check the type of the relation
if ( ! $relation->isOneToOne()) { if ( ! $relation->isOneToOne()) {
// initialize the collection // initialize the collection
if ($driver->initRelated($prev[$parent], $component)) { if ($driver->initRelated($prev[$parent], $componentAlias)) {
// append element // append element
if (isset($identifiable[$alias])) { if (isset($identifiable[$alias])) {
$index = $driver->search($element, $prev[$parent][$component]); $index = $driver->search($element, $prev[$parent][$componentAlias]);
if ($index === false) { if ($index === false) {
$prev[$parent][$component][] = $element; $prev[$parent][$componentAlias][] = $element;
} }
} }
// register collection for later snapshots // register collection for later snapshots
$driver->registerCollection($prev[$parent][$component]); $driver->registerCollection($prev[$parent][$componentAlias]);
} }
} else { } else {
$prev[$parent][$component] = $element; $prev[$parent][$componentAlias] = $element;
} }
$coll =& $prev[$parent][$component]; $coll =& $prev[$parent][$componentAlias];
} }
if ($index !== false) { if ($index !== false) {
......
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