title: Symfony 3 Too many parameters
body: <p>I'm new to Symfony, and I got an error while running a query :</p>
  
  <pre><code>public function getFilteredArticles($page, $nbPerPage, $data) {
          $query = $this-&gt;createQueryBuilder('a')
                  -&gt;leftJoin('a.images', 'i')
                  -&gt;addSelect('i')
                  -&gt;leftJoin('a.type_stockage', 't')
                  -&gt;addSelect('t')
                  -&gt;leftJoin('a.famille', 'f')
                  -&gt;addSelect('f');
          if ($data['famille'] != '') {
              $query-&gt;where('f.id = :famille')
                      -&gt;setParameter('famille', $data['famille']);
          }
          if ($data['rds'] == false) {
              $query-&gt;where('a.stock_actuel &gt; 0');
          }
          if ($data['recherche'] != '' &amp;&amp; $data['recherche'] != null) {
              $query-&gt;where('a.ref_article LIKE :recherche')
                      -&gt;setParameter('recherche', '%' . $data['recherche'] . '%');
          }
          $query-&gt;leftJoin('a.sousfamille', 's')
                  -&gt;orderBy('a.ref_article', 'ASC')
                  -&gt;getQuery();
  
          $query-&gt;setFirstResult(($page - 1) * $nbPerPage)
                  -&gt;setMaxResults($nbPerPage);
  
          return new Paginator($query, true);
      }
  </code></pre>
  
  <p>This query have conditionnals parameters as you can see, that returns the list of articles I need for a table. But when I run this query to fill my table, I got the error :</p>
  
  <blockquote>
    <p>An exception has been thrown during the rendering of a template ("Too
    many parameters: the query defines 0 parameters and you bound 1").</p>
  </blockquote>
  
  <p>I don't know why he is expecting 0 parameters. I tried using setParameters instead, but the result is the same.</p>
  
  <p>Does anyone has an idea?</p>