Answer the question
In order to leave comments, you need to log in
What is the error when forming a request or like?
Here is the actual request
$search = Search::find()->where(['or like', ['name','description'], $query])->limit(30);
or like: Similar to the like operator, only the LIKE clauses will be combined using the OR operator if the second operand is an array.
Answer the question
In order to leave comments, you need to log in
"...if the SECOND operand will be represented by an array."
'or like' - operator
['name','description'] - FIRST operand
$query - SECOND operand.
Do you understand?
or like not to search for several columns. Or like in order to make two conditions in one column through OR.
In your case, you should write like this:
Search::find()->orWhere(['like', 'name', $query])->orWhere(['like', 'description', $query])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question