伙计们,我如何在以下Where声明中应用OR条件?
$this->IbCommisions->find()->matching(
'Users.Accounts',function ($q) {
return $q->where(['IbCommisions.ib_id' => $this->userid, 'Users.country_id' => $this->request->data['country']]);
}
Run Code Online (Sandbox Code Playgroud)
成为类似的东西
(['IbCommisions.ib_id' => $this->userid OR 'Users.country_id' => $this->request->data['country']])
Run Code Online (Sandbox Code Playgroud)
return $q->where(['OR' => [
'IbCommisions.ib_id' => $this->userid,
'Users.country_id' => $this->request->data['country']
]]);
Run Code Online (Sandbox Code Playgroud)
或者
return $q->where(['IbCommisions.ib_id' => $this->userid])
->orWhere(['Users.country_id' => $this->request->data['country']]);
Run Code Online (Sandbox Code Playgroud)
http://book.cakephp.org/3.0/en/orm/query-builder.html#advanced-conditions
| 归档时间: |
|
| 查看次数: |
14124 次 |
| 最近记录: |