Answer the question
In order to leave comments, you need to log in
YII2 - fetch from database by array value in field other than ID?
I want to get all records from the database by array value. Everything works fine with the id field. With a different field - returns only the first value.
// все ок
$result = ArModel::find()->where([ 'id'=>[1,2,3] ])->all();
// только один объект - link
$result = ArModel::find()->where([ 'alias'=>['link', 'link2', 'link3'] ])->all();
Answer the question
In order to leave comments, you need to log in
$result = ArModel::find()->where([ 'alias'=>['link', 'link2', 'link3'] ])->all();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question