From e8c9cb2f2302681094b268fff439dfe30287c533 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Thu, 2 Apr 2015 23:45:46 +0100 Subject: [PATCH] Reverting BC break: `PersistentConnection#__construct()` now accepts `null|array|Collection` again --- lib/Doctrine/ORM/PersistentCollection.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index 98e3b91d8..7564133b9 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -101,16 +101,18 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec /** * Creates a new persistent collection. * - * @param EntityManagerInterface $em The EntityManager the collection will be associated with. - * @param ClassMetadata $class The class descriptor of the entity type of this collection. - * @param Collection $coll The collection elements. + * @param EntityManagerInterface $em The EntityManager the collection will be associated with. + * @param ClassMetadata $class The class descriptor of the entity type of this collection. + * @param Collection|array|null $collection The collection elements. */ - public function __construct(EntityManagerInterface $em, $class, $coll) + public function __construct(EntityManagerInterface $em, $class, $collection) { - $this->collection = $coll; $this->em = $em; $this->typeClass = $class; $this->initialized = true; + $this->collection = $collection instanceof Collection + ? $collection + : new ArrayCollection((array) $collection); } /**