joinWith('lang'); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => [ 'attributes' => [ 'seo_id', 'url', 'title' => [ 'asc' => [ 'seo_lang.title' => SORT_ASC ], 'desc' => [ 'seo_lang.title' => SORT_DESC ], ], 'description' => [ 'asc' => [ 'seo_lang.description' => SORT_ASC ], 'desc' => [ 'seo_lang.description' => SORT_DESC ], ], 'h1' => [ 'asc' => [ 'seo_lang.h1' => SORT_ASC ], 'desc' => [ 'seo_lang.h1' => SORT_DESC ], ], 'meta' => [ 'asc' => [ 'seo_lang.meta' => SORT_ASC ], 'desc' => [ 'seo_lang.meta' => SORT_DESC ], ], 'seo_text' => [ 'asc' => [ 'seo_lang.seo_text' => SORT_ASC ], 'desc' => [ 'seo_lang.seo_text' => SORT_DESC ], ], ], ], ]); $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; } // grid filtering conditions $query->andFilterWhere([ 'seo_id' => $this->seo_id, ]); $query->andFilterWhere([ 'like', 'url', $this->url, ]) ->andFilterWhere([ 'ilike', 'seo_lang.title', $this->title, ]) ->andFilterWhere([ 'ilike', 'seo_lang.description', $this->description, ]) ->andFilterWhere([ 'ilike', 'seo_lang.h1', $this->h1, ]) ->andFilterWhere([ 'ilike', 'seo_lang.meta', $this->meta, ]) ->andFilterWhere([ 'ilike', 'seo_lang.seo_text', $this->seo_text, ]); return $dataProvider; } }