How to create a `IN` clause in CakePHP query? -
how make in clause in new cakephp? i'm trying:
$restaurants->find()->where(['id' => $r_ids])->all();
where $r_ids
array of ids need in query, doesn't work expected.
with cakephp 3.x it's necessary either indicate data type, array of values need have []
appended type:
$query = $articles ->find() ->where(['id' => $ids], ['id' => 'integer[]']);
or explicitly make use of in
keyword:
$query = $articles ->find() ->where(['id in' => $ids]);
see also
Comments
Post a Comment