Skip to content

Commit fe80ac4

Browse files
committed
Trigger eager loading when using the attributes serializer option
1 parent 550f9ae commit fe80ac4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Bridge/Doctrine/Orm/Extension/EagerLoadingExtension.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,11 @@ private function joinRelations(QueryBuilder $queryBuilder, QueryNameGeneratorInt
137137
continue;
138138
}
139139

140-
if ((false === $propertyMetadata->isReadableLink() || false === $propertyMetadata->isReadable()) && false === $propertyMetadata->getAttribute('fetchEager', false)) {
141-
continue;
140+
if ($inAttributes = isset($context[AbstractNormalizer::ATTRIBUTES][$association])) {
141+
// prepare the child context
142+
$context[AbstractNormalizer::ATTRIBUTES] = $context[AbstractNormalizer::ATTRIBUTES][$association];
143+
} else {
144+
unset($context[AbstractNormalizer::ATTRIBUTES]);
142145
}
143146

144147
$isNullable = $mapping['joinColumns'][0]['nullable'] ?? true;

0 commit comments

Comments
 (0)