从 zf2 开始,使用 Zend\Db 查询 orWhere 不再可能 我在这里(ZF2 How to orWhere())发现可以替换它。 在我的示例中,没有“喜欢”,只有一个类似的查询:
$select->where("....")->orWhere("...")
如果使用 PredicateSet 是唯一的方法,我该如何使用它来进行查询?
最佳答案
最简单的方法是使用流利的表示法:
$where = new Zend\Db\Sql\Where;
$where->OR->equalTo('id', $id);
如有疑问,请查看 Ralph 在其 Zend_Db-Examples 存储库 (https://github.com/ralphschindler/Zend_Db-Examples) 中发布的示例。
关于zend-framework2 - orWhere在zf2中消失了。如何更换它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13458482/