title: How to return an empty Doctrine_Collection?
body: <p>I've a method that returns a Doctrine_Collection, with a <code>whereIn()</code> clause :</p>
  
  <pre><code>public function getByValues($values)
  {
    if (!is_array($values))
      throw new sfException('Wrong parameter type. Excepted array.');
  
    return Doctrine_Query::create()
      -&gt;from('Anomaly a')
      -&gt;whereIn('a.value', $values);
  }
  </code></pre>
  
  <p>However, when <code>$values</code> is an empty array, this method return <strong>all the rows that are in the AnomalyTable</strong>. This isn't an unexpected behavior, as documented in Doctrine documentation, and written here : <a href="https://stackoverflow.com/questions/5433151/doctrine-where-in-with-doctrine-query/5434628#5434628">Doctrine where in with Doctrine_Query</a></p>
  
  <p>However, I would like to return an empty <code>Doctrine_Collection</code> instead of the result of my query, when <code>$values</code> is an empty array.</p>
  
  <p>Any ideas on how I can do that ?</p>
  
  <p>Thanks =)</p>
  
  <h2>Edit:</h2>
  
  <p>Adding an impossible clause, like <code>-&gt;where('1=0')</code> would do the trick, but it is an unnecessary request to the DB server. Does anyone have a better idea ?</p>