title: Doctrine Query->getSQL() doesn't output any parameter
body: <p>In Symfony2 I got the next code in a custom repository function:</p>
  
  <pre><code>    $em = $this-&gt;getEntityManager();
      $qb = $em-&gt;createQueryBuilder();
  
      $any = "Jon";
  
      $qb-&gt;select('s')
          -&gt;from('AppBundle:Student', 's');
  
  
      if ($criteria) {
          foreach ($criteria as $field =&gt; $value) {
              $qb-&gt;andWhere($qb-&gt;expr()-&gt;eq('s.' . $field, $value));
          }
      }
  
      $qb-&gt;andWhere(
          $qb-&gt;expr()-&gt;orX(
              $qb-&gt;expr()-&gt;like('s.firstname', ":any"),
              $qb-&gt;expr()-&gt;like('s.lastname', ":any"),
              $qb-&gt;expr()-&gt;like('s.dni', ":any"),
              $qb-&gt;expr()-&gt;like('s.email', ":any")
          )
      );
      if ($offset) {
          $qb-&gt;setFirstResult($offset);
      }
      if ($limit) {
          $qb-&gt;setMaxResults($limit);
      }
  
      $query = $qb-&gt;getQuery();
  
      $query-&gt;setParameter('any',(string) $any);
  
      $logger-&gt;warning(__METHOD__ . ": " . json_encode($query-&gt;getSQL()));
  
      $result = $query-&gt;getResult();
  </code></pre>
  
  <p>But $result is always empty. Maybe because $query->getSQL() always returns:</p>
  
  <pre><code>"SELECT p0_.id AS id0, p0_.firstname AS firstname1, p0_.lastname AS lastname2, p0_.email AS email3, p0_.dni AS dni4, p0_.phonenumber AS phonenumber5, p0_.active AS active6, p0_.birthdate AS birthdate7, p0_.sex AS sex8, p0_.discr AS discr9 
  FROM student s1_ INNER JOIN person p0_ ON s1_.id = p0_.id 
  WHERE p0_.active = 1 AND (p0_.firstname LIKE ? OR p0_.lastname LIKE ? OR p0_.dni LIKE ? OR p0_.email LIKE ?) LIMIT 15"
  </code></pre>
  
  <p>The thing is, if I misspell the parameter name it throws an Exception, so the $query->setParameter line is executing. It's just... not working :S</p>
  
  <p><strong>UPDATE 1:</strong></p>
  
  <p>It was suggested that it might be caused by the same parameter being reused. I updated the code to: </p>
  
  <pre><code> (...)
      $qb-&gt;andWhere(
              $qb-&gt;expr()-&gt;orX(
                  $qb-&gt;expr()-&gt;like('s.firstname', ":fn"),
                  $qb-&gt;expr()-&gt;like('s.lastname', ":ln"),
                  $qb-&gt;expr()-&gt;like('s.dni', ":dni"),
                  $qb-&gt;expr()-&gt;like('s.email', ":email")
              )
          );
      (...)
          $query = $qb-&gt;getQuery();
          $query-&gt;setParameters(array('fn' =&gt; $any, 'ln' =&gt; $any, "dni" =&gt; $any, "email" =&gt; $any));
  </code></pre>
  
  <p>NO CHANGES. :&lt;</p>
  
  <p><strong>UPDATE 2:</strong></p>
  
  <p>Tried         </p>
  
  <pre><code>$qb-&gt;setParameters(array('fn' =&gt; $any, 'ln' =&gt; $any, "dni" =&gt; $any, "email" =&gt; $any));
  
  $query = $qb-&gt;getQuery();
  
  $logger-&gt;warning(__METHOD__ . ": " . json_encode($query-&gt;getSQL()));
  </code></pre>
  
  <p>...No changes.</p>
  
  <p><strong>UPDATE 3:</strong></p>
  
  <p>Debugging parameters as suggested:</p>
  
  <p>Code: </p>
  
  <pre><code>$query = $qb-&gt;getQuery();
  
  $parameters = $qb-&gt;getQuery()-&gt;getParameters()-&gt;toArray();
  foreach ($parameters as $parameter) {
          $logger-&gt;warning(__METHOD__ . ": Parameter -&gt; ".json_encode($parameter-&gt;getName())." = ".json_encode($parameter-&gt;getValue()));
      }
  $logger-&gt;warning(__METHOD__ . ": " . json_encode($query-&gt;getSQL()));
  </code></pre>
  
  <p>Log:</p>
  
  <pre><code> app.WARNING: AppBundle\Entity\StudentRepository::findByAny: Parameter -&gt; "fn" = "Jon" [] []
   app.WARNING: AppBundle\Entity\StudentRepository::findByAny: Parameter -&gt; "ln" = "Jon" [] []
   app.WARNING: AppBundle\Entity\StudentRepository::findByAny: Parameter -&gt; "dni" = "Jon" [] []
   app.WARNING: AppBundle\Entity\StudentRepository::findByAny: Parameter -&gt; "email" = "Jon" [] []
   app.WARNING: AppBundle\Entity\StudentRepository::findByAny: "SELECT p0_.id AS id0, p0_.firstname AS firstname1, p0_.lastname AS lastname2, p0_.email AS email3, p0_.dni AS dni4, p0_.phonenumber AS phonenumber5, p0_.active AS active6, p0_.birthdate AS birthdate7, p0_.sex AS sex8, p0_.discr AS discr9 FROM student s1_ INNER JOIN person p0_ ON s1_.id = p0_.id WHERE p0_.active = 1 AND (p0_.firstname = ? OR p0_.lastname = ? OR p0_.dni = ? OR p0_.email = ?) LIMIT 15" [] []
  </code></pre>
  
  <p>Still no results, and the SQL still shows "?". Though I think I found the error...</p>