1
0
mirror of synced 2025-02-02 21:41:45 +03:00

Fix second level caching for queries with multiple joins

The $metadata of the main entity is not always the metadata you need here, for example when you do join A with B and then B with C. For the second join it was using the metadata from A.
This commit is contained in:
Kris Pypen 2015-07-03 14:45:25 +02:00
parent 6b3056ff8c
commit a2a400b8fb

View File

@ -259,7 +259,8 @@ class DefaultQueryCache implements QueryCache
} }
// @TODO - move to cache hydration components // @TODO - move to cache hydration components
foreach ($rsm->relationMap as $name) { foreach ($rsm->relationMap as $alias => $name) {
$metadata = $this->em->getClassMetadata($rsm->aliasMap[$rsm->parentAliasMap[$alias]]);
$assoc = $metadata->associationMappings[$name]; $assoc = $metadata->associationMappings[$name];
if (($assocValue = $metadata->getFieldValue($entity, $name)) === null || $assocValue instanceof Proxy) { if (($assocValue = $metadata->getFieldValue($entity, $name)) === null || $assocValue instanceof Proxy) {