$query, ]); $dataProvider->setSort([ 'attributes' => [ 'id', 'user_id', 'art', 'dt', 'name' => [ 'default' => SORT_ASC ] ] ]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->joinWith(['accounts']); $query->andFilterWhere([ 'id' => $this->id, 'user_id' => $this->user_id, ]); $query->andFilterWhere(['like', 'art', $this->art]) ->andFilterWhere(['like', 'dt', $this->dt]); //$query->andFilterWhere(['like', Accounts::tableName().'.name', $this->name]); return $dataProvider; } }