From 39f4d46d364d17f21a873a93422a19d9b12a9e93 Mon Sep 17 00:00:00 2001 From: Austin Morris Date: Mon, 22 Jul 2013 14:42:03 -0400 Subject: [PATCH] Initialize coll when using Collection methods inside PersistentCollection --- lib/Doctrine/ORM/PersistentCollection.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index 947774542..462c23ec7 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -587,6 +587,8 @@ final class PersistentCollection implements Collection, Selectable */ public function add($value) { + $this->initialize(); + $this->coll->add($value); $this->changed(); @@ -757,6 +759,8 @@ final class PersistentCollection implements Collection, Selectable */ public function key() { + $this->initialize(); + return $this->coll->key(); } @@ -765,6 +769,8 @@ final class PersistentCollection implements Collection, Selectable */ public function current() { + $this->initialize(); + return $this->coll->current(); } @@ -773,6 +779,8 @@ final class PersistentCollection implements Collection, Selectable */ public function next() { + $this->initialize(); + return $this->coll->next(); }