title: Dql query with optional parameters
body: <p>I would like to know how to make a DQL query with optional parameters for exemple:</p>
  
  <pre><code>public function getUsers($city, $sex, $age)
      {
          $qb = $this-&gt;getEntityManager()-&gt;createQueryBuilder()
              -&gt;select('u')
              -&gt;where('u.sex = :sex')
              -&gt;andWhere('u.city = :city')
              -&gt;andWhere('u.age = :age')
          -&gt;setParameter(':city', $city);
          -&gt;setParameter(':sex', $sex);
          -&gt;setParameter(':age', $age);
          $query = $qb-&gt;getQuery();
          $result = $query-&gt;getResult();
  
      }
  </code></pre>
  
  <p>How to do if one of the parameters is not defined(=NULL) ?</p>