title: How to get child object from parent with one to many relation in Symfony2
body: <p>I have a parent object what an account is. This account object has a one to many relation with its child object what a mailList is. </p>
  
  <pre><code>Parent:
  
      class CusAccount
      {
  
          public function __construct()
          {
              $this-&gt;mailList = new ArrayCollection();
          }
  
          /**
           * @ORM\OneToMany(targetEntity="MailList", mappedBy="account")
           */
          private $mailList;
  
          /**
          * Get mailList
          *
          * @return \Doctrine\Common\Collections\Collection 
          */
          public function getMailList()
          {
                return $this-&gt;mailList;
          }
  
      }
  
  Child:
  
  class MailList
  {
  
      /**
       * @ORM\ManyToOne(targetEntity="CusAccount")
       * @ORM\JoinColumn(name="account_id", referencedColumnName="id")
       */
      private $account;
  
      /**
      * @var string
      *
      * @ORM\Column(name="email", type="string", length=50)
      *
      */
     private $email;
  
  }
  </code></pre>
  
  <p>Adding multiple childs to the parent works fine. I double check in the databse. Also getting the first child back works with:</p>
  
  <pre><code>$child = $account-&gt;getMailinglist()-&gt;first();
  </code></pre>
  
  <p>Only now I want to find a child by its email adres. I cannot find the correct code for this?</p>