From 8794d35867edfab21468d23d388ad231fb306499 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Wed, 9 Mar 2011 23:30:35 +0100 Subject: [PATCH] DDC-952 - Woah this still needs tons of tests. --- lib/Doctrine/ORM/UnitOfWork.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 2326ef5d1..3704be04e 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -1901,6 +1901,8 @@ class UnitOfWork implements PropertyChangedListener } } + unset($this->eagerLoadingEntities[$class->name][$idHash]); + // Properly initialize any unfetched associations, if partial objects are not allowed. if ( ! isset($hints[Query::HINT_FORCE_PARTIAL_LOAD])) { foreach ($class->associationMappings as $field => $assoc) { @@ -1947,7 +1949,7 @@ class UnitOfWork implements PropertyChangedListener $newValue instanceof Proxy && $newValue->__isInitialized__ === false) { - $this->eagerLoadingEntities[$assoc['targetEntity']][] = $relatedIdHash; + $this->eagerLoadingEntities[$assoc['targetEntity']][$relatedIdHash] = current($associatedId); } } else { if ($targetClass->subClasses) { @@ -1959,7 +1961,7 @@ class UnitOfWork implements PropertyChangedListener if ($assoc['fetch'] == ClassMetadata::FETCH_EAGER || isset($hints['fetchEager'][$class->name][$field])) { if (isset($hints['deferEagerLoad']) && !$targetClass->isIdentifierComposite) { // TODO: Is there a faster approach? - $this->eagerLoadingEntities[$assoc['targetEntity']][] = current($id); + $this->eagerLoadingEntities[$assoc['targetEntity']][$relatedIdHash] = current($associatedId); $newValue = $this->em->getProxyFactory()->getProxy($assoc['targetEntity'], $associatedId); } else {