diff --git a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php index c1bcc2591..3cedaada0 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php @@ -189,8 +189,8 @@ class ObjectHydrator extends AbstractHydrator $relation = $class->associationMappings[$fieldName]; $value = $class->reflFields[$fieldName]->getValue($entity); - if ($value === null) { - $value = new ArrayCollection; + if ($value === null || is_array($value)) { + $value = new ArrayCollection((array) $value); } if ( ! $value instanceof PersistentCollection) {