From 20f41ea73830ae7facec978aa60e77be3b64bc93 Mon Sep 17 00:00:00 2001 From: ondrowan Date: Sun, 28 Oct 2012 19:51:06 +0100 Subject: [PATCH] Initialized children in field model as ArrayCollection --- Model/Field.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Model/Field.php b/Model/Field.php index 4e69dfd..ed671f7 100644 --- a/Model/Field.php +++ b/Model/Field.php @@ -11,6 +11,7 @@ namespace Bait\PollBundle\Model; +use Doctrine\Common\Collections\ArrayCollection; use Symfony\Component\Validator\Constraint; /** @@ -88,6 +89,7 @@ abstract class Field implements FieldInterface public function __construct() { $this->setCreatedAt(new \DateTime()); + $this->children = new ArrayCollection(); } /** @@ -107,7 +109,7 @@ public function getId() */ public function addChild(FieldInterface $child) { - if (!in_array($child, $this->children, true)) { + if (!$this->children->contains($child)) { $this->children[] = $child; }