public $fullName;
[['fullName'], safe]
....
/**
* Настройка параметров сортировки
* Важно: должна быть выполнена раньше $this->load($params)
*/
$dataProvider->setSort([
'attributes' => [
'id',
'fullName' => [
'asc' => ['last_name' => SORT_ASC, 'name' => SORT_ASC],
'desc' => ['last_name' => SORT_DESC, 'name' => SORT_DESC],
'label' => 'Full Name',
'default' => SORT_ASC
],
'country_id'
]
]);
....
$query->andFilterWhere(['like', 'last_name', $this->fullName])
->orFilterWhere(['like', 'name', $this->fullName])
->orFilterWhere(['like', 'middle_name', $this->fullName]);
$query = new Query();
$query->select(['profile.user_id as id, CONCAT_WS(" ", profile.last_name, profile.name, profile.middle_name) AS text'])
->from('profile')
->leftJoin('user','profile.user_id = user.id','user.id = 10')
->leftJoin('auth_assignment','auth_assignment.user_id = profile.user_id')
->where('CONCAT_WS(" ", last_name, name, middle_name) LIKE :search')
->params([':search' => '%' . $search . '%'])
->orderBy(['last_name' => 'SORT_ASC', 'name' => 'SORT_ASC', 'middle_name' => 'SORT_ASC'])
->andWhere(['auth_assignment.item_name'=>'organizer'])
->andWhere(['user.status'=>\common\models\User::STATUS_ACTIVE])
->limit(20);
$command = $query->createCommand();
$data = $command->queryAll();
$this->fullName
разбивать по пробелу и получать имя, фамилию и отчество отдельно.$this->fullName
подставляется во все три поля в like
.