Skip to content

Commit

Permalink
Initialized children in field model as ArrayCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrowan committed Oct 28, 2012
1 parent f04a8dc commit 20f41ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Model/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Bait\PollBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraint;

/**
Expand Down Expand Up @@ -88,6 +89,7 @@ abstract class Field implements FieldInterface
public function __construct()
{
$this->setCreatedAt(new \DateTime());
$this->children = new ArrayCollection();
}

/**
Expand All @@ -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;
}

Expand Down

0 comments on commit 20f41ea

Please sign in to comment.