i have a task - add to search model searching by full name. Full name is first name + last name. So i need to build query like
WHERE first_name LIKE \'%var%\
You should simply try :
$query->andFilterWhere([
'or',
['like', 'profiles.first_name', $this->userFullName],
['like', 'profiles.last_name', $this->userFullName],
]);
or
: similar to theand
operator except that the operands are concatenated usingOR
. For example,['or', ['type' => [7, 8, 9]], ['id' => [1, 2, 3]]
will generate(type IN (7, 8, 9) OR (id IN (1, 2, 3)))
.
Read more : http://www.yiiframework.com/doc-2.0/yii-db-queryinterface.html#where()-detail