title: How to findBy on one attribute which can be of different values
body: <p>I'm trying to display a table, in which the user will decide which objets will be shown by selecting different options in a form.</p>
  
  <pre><code> if ($form-&gt;isValid()) {
          $type = $form-&gt;get('type')-&gt;getData();
          //Getting values from Array $type returned by getData on the form
          foreach ($type as $livraison) {
  
              $elements = $this-&gt;getDoctrine()
                      -&gt;getManager()
                      -&gt;getRepository('etaqenregistrementBundle:Livraison')
                      -&gt;findBy(array('type' =&gt; $livraison));
          }
  
      }
  </code></pre>
  
  <p>If we selected two options, $type will be an array which contains two different objects $livraison (<strong>var_dump($livraison)</strong> in the foreach statement ) : </p>
  
  <blockquote>
    <p>object(etaq\adminBundle\Entity\typeLivraison)[434]
      private 'id' => int 1
      private 'valeur' => string 'Interne' (length=7)</p>
    
    <p>object(etaq\adminBundle\Entity\typeLivraison)[436]
      private 'id' => int 3
      private 'valeur' => string 'Autorité' (length=9)</p>
  </blockquote>
  
  <p>But findBy method returns only one object, the one which was selected first in the form. </p>
  
  <p>What I want is to sort on ONE parameter if user selected one in the form, or to sort on TWO if he selected two, or three ... etc</p>
  
  <p>Here is my form : </p>
  
  <pre><code>    $form = $this-&gt;createFormBuilder()
              -&gt;add('ecart', 'choice', array(
                  'label' =&gt; 'Only late :',
                  'choices' =&gt; array(true =&gt; 'Yes', false =&gt; 'No'),
                  'multiple' =&gt; false,
                  'expanded' =&gt; true,
                  'required' =&gt; true,
                  'empty_data' =&gt; false))
              -&gt;add('type', 'entity', array(
                  'label' =&gt; ' Type :',
                  'class' =&gt; 'etaqadminBundle:typeLivraison',
                  'empty_data' =&gt; false,
                  'required' =&gt; true,
                  'property' =&gt; 'valeur',
                  'multiple' =&gt; true,
                  'expanded' =&gt; true))
              -&gt;getForm();
  </code></pre>
  
  <p>Thanks guys. </p>