diff --git a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php index 019d1a2463..8772449fce 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php @@ -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(); }