title: Magento, filter collection by date period and include null values
body: <p>I'm having a difficult time settling up a dates filter on a collection with custom tables. Have searched <a href="http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/using_collections_in_magento" rel="nofollow">here</a> and <a href="http://dbhoopendra.blogspot.com.es/2012/04/addattributetofilter-conditionals-in.html#.ULYideR_nX9" rel="nofollow">here</a> and some other places but still can not get what I need. The problem is that I can't add the <code>NULL</code> values to the result set.</p>
  
  <p>So far my current code after several trial and error tests:</p>
  
  <pre><code>$myBannersCollection = Mage::getModel('banners/bannersadmin')-&gt;getCollection()
                     -&gt;addfieldtofilter('banner_prod_id',$currentProdID)
                     -&gt;addfieldtofilter('banner_start_date', 
                         array(
                           array('from' =&gt; Mage::getModel('core/date')-&gt;gmtDate()),
                                   'banner_start_date' =&gt; null))
                     -&gt;addfieldtofilter('banner_end_date',
                         array(
                           array('gteq' =&gt; Mage::getModel('core/date')-&gt;gmtDate()),
                                   'null' =&gt; true)
                                    );
  var_dump((string) $myBannersCollection-&gt;getselect());
  </code></pre>
  
  <p>This code ouputs the following sql snippet:</p>
  
  <pre><code>SELECT `main_table`.* 
    FROM `dts_banners_admin` AS `main_table` 
   WHERE (banner_prod_id = '16')
    AND (((banner_start_date &gt;= '2012-11-28 14:39:13') OR (banner_start_date='')))
     AND (banner_end_date IS NULL)
  </code></pre>
  
  <p>Have tried several different options to add the <code>NULL</code> condition but no way I can get something like:</p>
  
  <pre><code>SELECT `main_table`.* 
    FROM `dts_banners_admin` AS `main_table` 
   WHERE (banner_prod_id = '16')
    AND (((banner_start_date&gt;='2012-11-28 14:39:13') OR (banner_start_date IS NULL)))
     AND ((banner_end_date &gt;= '2012-11-28 14:39:13') OR (banner_end_date IS NULL))
  </code></pre>
  
  <p>PS: does Magento has a <code>BETWEEN</code> operator on the <code>addfieldtofilter</code>?</p>