title: Foreach statement inside $query->andWhere()
body: <p>I need to create a query with Doctrine QueryBuilder using a foreach statement, currently, the following one is used but is not the most correct:</p>
  <pre class="lang-php prettyprint-override"><code>// $query object
  foreach ($searches as $value) {
      $query-&gt;andWhere($query-&gt;expr()-&gt;orX(
          $query-&gt;expr()-&gt;eq('c.firstName', ':name'),
          $query-&gt;expr()-&gt;eq('c.lastName', ':name')
      ))-&gt;setParameter('name', $value);
  }
  </code></pre>
  <p>this gives me :</p>
  <blockquote>
  <p>....WHERE ....</p>
  <p>AND (a0_.first_name = ? OR a0_.last_name = ?)</p>
  <p>AND (a0_.first_name = ? OR a0_.last_name = ?)</p>
  <p>ORDER BY a0_.first_name ASC</p>
  </blockquote>
  <p>while I need:</p>
  <blockquote>
  <p>...WHERE .....</p>
  <p>AND (a0_.first_name = ? OR a0_.last_name = ? OR a0_.first_name = ? OR a0_.last_name = ?)</p>
  <p>ORDER BY a0_.first_name ASC</p>
  </blockquote>
  <p>I need something like this, but PHP doesn't allow it of course:</p>
  <pre class="lang-php prettyprint-override"><code>// $query object
  $query-&gt;andWhere($query-&gt;expr()-&gt;orX(
      foreach ($searches as $value) {
          $query-&gt;expr()-&gt;eq('c.firstName', ':name'),
          $query-&gt;expr()-&gt;eq('c.lastName', ':name')
      }
  ))
  -&gt;setParameter('name', $value);
  </code></pre>
  <p>Could you please help me use the foreach statement to reach my goal? Your usual help is appreciated.</p>