Using Magentos collection models, how should I go about adding a query part/filter such as this:
WHERE (main_table.x < 1 OR (main_table.x - main_table.y) >= 5)
Update I'm now running this:
$this->getSelect()
->where('main_table.x < 1')
->orWhere('(main_table.x - main_table.y) >= :qty');
$this->addBindParam(':qty', $qty);
Result:
SELECT ... WHERE ... AND ... AND (main_table.x < 1) OR ((main_table.x - main_table.y) >= :qty) ORDER BY ...
The issue is that I can't seem to get to bind $qty
to :qty
Update 2
I ended up with this, since I needed the OR
within parentheses
$this->getSelect()->where('(main_table.x < 1 OR (main_table.x - main_table.y) >= ?)', $qty);