title: Symfony Form Error: "Expected argument of type "Doctrine\ORM\QueryBuilder", "Doctrine\ORM\Query" given"
body: <p>I have two form inside the Controller the first form works fine however my second Form does not work as expected.</p>
  
  <p>MyController:</p>
  
  <pre><code>// Second Form
  $formTwo = $this-&gt;get('form.factory')-&gt;createNamedBuilder('form2name', new CarType(), null, array())
          -&gt;getForm();
  
  if('POST' === $request-&gt;getMethod()) {
  
  if ($request-&gt;request-&gt;has('form1name')) {
      // handle the first form  
  }
  
  if ($request-&gt;request-&gt;has('form2name')) {
      // handle the second form 
      // get the id value of the selected value. 
    }
  }
  </code></pre>
  
  <p>My CarType:</p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options){
  
     $builder-&gt;add('makename','entity',array(
                      'class'=&gt; 'MyTestBundle:Car\CarModel',
                      'query_builder'=&gt;function(EntityRepository $er){
                          return $query = $er-&gt;createQueryBuilder('s')
                                      -&gt;select('s.makename')
                                      -&gt;distinct()
                                      -&gt;orderBy('s.makename','ASC');
                  }
  
     ));
    $builder-&gt;add('search','submit',array());
  }
  </code></pre>
  
  <p><a href="https://gist.github.com/anonymous/99b8d0048259d3ceaca1" rel="nofollow">My Car Entity</a></p>
  
  <p><a href="https://gist.github.com/gghhh456/e75535e999565a579a13" rel="nofollow">Full Stack Trace</a></p>
  
  <blockquote>
    <p>Error : "Expected argument of type "Doctrine\ORM\QueryBuilder", "Doctrine\ORM\Query" given"</p>
  </blockquote>
  
  <p>Symfony Version : 2.7</p>