title: Doctrine add condition to createQueryBuilder if condition provided
body: <p>I have following function:</p>
  
  <pre><code>public function latestNews($tags = array(), $categories = array(), $authors = array(), $lang = 'en', $source = '', $limit = 20) {
      return $this-&gt;createQueryBuilder('News')
      -&gt;field('tags')-&gt;in($tags)
      -&gt;field('categories')-&gt;in($category)
      -&gt;field('authors')-&gt;in($authors)
      -&gt;field('lang')-&gt;equals($lang)
      -&gt;sort('date' -&gt; 'DESC')
      -&gt;field('source')-&gt;equals($source)
      -&gt;limit($limit)
      -&gt;getQuery()
      -&gt;execute();
  }
  </code></pre>
  
  <p>I want if variables such as <code>$tags</code>, <code>$categories</code>, <code>$authors</code> or <code>$source</code> provided by function caller this variables affect on the <code>createQueryBuilder</code>, but if each of them does not provide by the function caller(variable with default value) they don't affect createQueryBuilder and make this condition neutral on query.
  One way is I make the query with many if condition but it is very messy.
  Is there any better solution?</p>