Skip to content

Commit

Permalink
Check if association already contains object (#9579)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bartels committed Mar 10, 2022
1 parent 2702b89 commit d1515b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,10 @@ protected function hydrateRowData(array $row, array &$result)
$reflFieldValue->hydrateSet($indexValue, $element);
$this->identifierMap[$path][$id[$parentAlias]][$id[$dqlAlias]] = $indexValue;
} else {
$reflFieldValue->hydrateAdd($element);
$reflFieldValue->last();
if (! $reflFieldValue->contains($element)) {
$reflFieldValue->hydrateAdd($element);
$reflFieldValue->last();
}
$this->identifierMap[$path][$id[$parentAlias]][$id[$dqlAlias]] = $reflFieldValue->key();
}

Expand Down

0 comments on commit d1515b3

Please sign in to comment.