From 58e20c70c6bd49ed0801d7c40120c3b33d6b2422 Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Wed, 11 Feb 2015 15:56:19 +0100 Subject: [PATCH] Store column values of not cache-able associations --- lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php b/lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php index 1190b38fd..a71d5dd89 100644 --- a/lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php +++ b/lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php @@ -73,8 +73,15 @@ class DefaultEntityHydrator implements EntityHydrator } if ( ! isset($assoc['cache']) || ! ($assoc['type'] & ClassMetadata::TO_ONE)) { + $associatedEntity = $data[$name]; unset($data[$name]); + if ($this->uow->isInIdentityMap($associatedEntity)) { + $targetEntityMetadata = $this->em->getClassMetadata($assoc['targetEntity']); + foreach ($this->uow->getEntityIdentifier($associatedEntity) as $fieldName => $fieldValue) { + $data[$assoc['targetToSourceKeyColumns'][$targetEntityMetadata->getColumnName($fieldName)]] = $fieldValue; + } + } continue; }