title: Magento collection - nested where clause using addAttributeToFilter
body: <p>I am trying to add multiple filters to a magento collection which I can do on a basic level. 
  What I really want to do is to be able to filter a collection by a number of nested filters which could be any level deep. For example i know I can add mutiple filters using code like:</p>
  
  <pre><code>$collection-&gt;addAttributeToFilter('example_attribute', array('eq' =&gt; 1));
  </code></pre>
  
  <p>What I want to be able to do is to have filters (AND &amp; OR) that can be nested within each other. I am not sure if Magento collection allow you to do this already but I have not been able to find any examples online.</p>
  
  <p>To give further detail and example:
  I would need to filter a collection where the equivalent SQL (ignore the selected fields I need and the JOINS) would be:</p>
  
  <pre><code>SELECT .........
  
  WHERE 
  
  (attribute1 = 1
  OR 
  atttribute2 = 'yes')
  
  AND
  qty &gt; 5
  
  AND(
    (attribute3 != 'no'
    AND 
    attribute4 = 50 )
    OR
    (attribute3 != 'no'
    AND 
    attribute6 &gt; 50 )
    )
  </code></pre>
  
  <p>This is just a quick crude example but the basic problem is how to nest any number of filters.</p>