From 3a39bea9f06ba8f180268d08530ea51891cfc2f7 Mon Sep 17 00:00:00 2001 From: romanb Date: Wed, 9 Dec 2009 16:06:39 +0000 Subject: [PATCH] [2.0][DDC-171] Fixed. --- lib/Doctrine/DBAL/Logging/DebugStack.php | 2 +- lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php | 2 +- lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/DBAL/Logging/DebugStack.php b/lib/Doctrine/DBAL/Logging/DebugStack.php index 48235e0b7..7a1bf1fd3 100644 --- a/lib/Doctrine/DBAL/Logging/DebugStack.php +++ b/lib/Doctrine/DBAL/Logging/DebugStack.php @@ -29,7 +29,7 @@ class DebugStack implements SqlLogger public function logSql($sql, array $params = null) { - if($this->enabled) { + if ($this->enabled) { $this->queries[] = array('sql' => $sql, 'params' => $params); } } diff --git a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php index c702cca17..0486b4b23 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php @@ -305,7 +305,7 @@ abstract class AbstractHydrator */ private function _lookupDeclaringClass($class, $fieldName) { - //FIXME: What if two subclasses declare a (mapped) field with the same name? + // FIXME: What if two subclasses declare a (mapped) field with the same name? // We probably need to encode the information to which subclass a field // belongs in the column alias / result set mapping. // This would solve the issue and would probably make this lookup superfluous. diff --git a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php index b42a10210..f797f4f29 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php @@ -354,6 +354,7 @@ class ObjectHydrator extends AbstractHydrator } } else { $targetClass->reflFields[$inverseAssoc->sourceFieldName]->setValue($element, $parentObject); + $this->_uow->setOriginalEntityProperty(spl_object_hash($element), $inverseAssoc->sourceFieldName, $parentObject); } } else if ($parentClass === $targetClass && $relation->mappedByFieldName) { // Special case: bi-directional self-referencing one-one on the same class @@ -362,6 +363,7 @@ class ObjectHydrator extends AbstractHydrator } else { // For sure bidirectional, as there is no inverse side in unidirectional mappings $targetClass->reflFields[$relation->mappedByFieldName]->setValue($element, $parentObject); + $this->_uow->setOriginalEntityProperty(spl_object_hash($element), $relation->mappedByFieldName, $parentObject); } // Update result pointer $this->_resultPointers[$dqlAlias] = $element;