How do you make it where in clause in new CakePHP? I'm trying:
$restaurants->find()->where(['id' => $r_ids])->all();
Where $r_ids
is array of ids I need in my query, but this doesn't work as expected.
How do you make it where in clause in new CakePHP? I'm trying:
$restaurants->find()->where(['id' => $r_ids])->all();
Where $r_ids
is array of ids I need in my query, but this doesn't work as expected.
Try this one for CakePHP 3.x
You can also use the short syntax:
With CakePHP 3.x it's now necessary to either indicate the data type, which for an array of values need to have
[]
appended to the type:or to explicitly make use of the
IN
keyword:See also
In Cakephp 3.x, If you have multiple where conditions then your query will be as below: