如果仅仅是多个orwhere条件,其实就是默认的andWhere和orWhere的标准写法,但如果条件是:

queue_name != '' and ( queue_status = '' or (queue_status ='error' and retry = 0))这样的要求,用Yii AR 就比较难写了。
demo如下:
$files = XXXX::find()
->andWhere(['<>', 'queue_name', ''])
->andWhere(['or',
['queue_status' => ''],
[
'and',
['queue_status' =>'error'],
['retry' => 0]
]
])
->all();
其实也就这样了。。
重点:
1、不等于的写法
2、或条件其实不是用orWhere,而是用andWhere
3、如果orWhere条件中有双重条件,得使用数组,并使用and进行连接
BTW:今天是PHPcon的第一天,然而我却没空去。我是陪读的书童~~~