Skip to content

Commit e399d21

Browse files
committed
Simplify condition, improve comment on this edge case.
1 parent 16f355f commit e399d21

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/UnitOfWork.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,8 +3252,10 @@ private function eagerLoadCollections(array $collections, array $mapping): void
32523252
foreach ($found as $targetValue) {
32533253
$sourceEntity = $targetProperty->getValue($targetValue);
32543254

3255-
// In cases where the hydration $targetValue has not yet fully completed
3256-
if ($sourceEntity === null && isset($targetClass->associationMappings[$mappedBy]['joinColumns'])) {
3255+
if ($sourceEntity === null) {
3256+
// case where the hydration $targetValue itself has not yet fully completed, for example
3257+
// in case a bi-directional association is being hydrated and deferring eager loading is
3258+
// not possible due to subclassing.
32573259
$data = $this->getOriginalEntityData($targetValue);
32583260
$id = [];
32593261
foreach ($targetClass->associationMappings[$mappedBy]['joinColumns'] as $joinColumn) {

0 commit comments

Comments
 (0)