title: Doctrine query builder - Too few parameters
body: <p>I made a Doctrine query builder query and I have this error :</p>
  
  <pre><code>Too few parameters : The query defines 3 parameters but you only bound 2.
  </code></pre>
  
  <p>I have looked at the query and tried some refactoring but I can't find where the code is wrong.</p>
  
  <p>The query :</p>
  
  <pre><code>$query = $this-&gt;_em-&gt;createQueryBuilder();
  $query-&gt;select('m')
        -&gt;from(Matiere::class, 'm')
        -&gt;join('m.ues', 'ue')
        -&gt;andWhere($query-&gt;expr()-&gt;eq('ue.semester', ':semestre'))
        -&gt;setParameter('semestre', $semestre);
  
  if (count($UEs) === 1) {
      $query-&gt;andWhere($query-&gt;expr()-&gt;neq('ue.id', ':ueSpe'))
            -&gt;setParameter('ueSpe', $UEs);
  }
  else {
      $ueM = $UEs[0];
      $ueP = $UEs[1];
      $query-&gt;andWhere($query-&gt;expr()-&gt;neq('ue.id', ':ueM'))
            -&gt;andWhere($query-&gt;expr()-&gt;neq('ue.id', ':ueP'))
            -&gt;setParameters(['ueM' =&gt; $ueM, 'ueP' =&gt; $ueP]);
  }
  return $query-&gt;getQuery()-&gt;getResult();
  </code></pre>