Here is the actual request

$search = Search::find()->where(['or like', ['name','description'], $query])->limit(30); 

You give this error

 strpos() expects parameter 1 to be string, array given 

the documentation is described as follows

or like: is similar to the like operator, only LIKE statements will be combined using the OR operator if the second operand is represented by an array.

  • As I understood it, the format of the operators is transmitted first, the field name is the second, and options are the third. Accordingly, you now have an array in the place where the name of the field to which this operator applies is specified. For what should it be used now? - Alexey Shimansky

1 answer 1

Try this:

 $search = Search::find() ->where([ 'OR', ['like', 'name', $query], ['like', 'description', $query] ]) ->limit(30);