【发布时间】:2012-03-13 06:29:57
【问题描述】:
使用 Magento 集合模型,我应该如何添加查询部分/过滤器,例如:
WHERE (main_table.x < 1 OR (main_table.x - main_table.y) >= 5)
更新 我现在正在运行这个:
$this->getSelect()
->where('main_table.x < 1')
->orWhere('(main_table.x - main_table.y) >= :qty');
$this->addBindParam(':qty', $qty);
结果:
SELECT ... WHERE ... AND ... AND (main_table.x < 1) OR ((main_table.x - main_table.y) >= :qty) ORDER BY ...
问题是我似乎无法将$qty 绑定到:qty
更新 2
我最终得到了这个,因为我需要括号内的OR
$this->getSelect()->where('(main_table.x < 1 OR (main_table.x - main_table.y) >= ?)', $qty);
【问题讨论】:
标签: php zend-framework magento php-5.3