joinWith('lang'); $dataProvider = new ActiveDataProvider( [ 'query' => $query, 'sort' => [ 'attributes' => [ 'id', 'sort', 'is_filter', 'groupName' => [ 'asc' => [ 'tax_group_lang.title' => SORT_ASC ], 'desc' => [ 'tax_group_lang.title' => SORT_DESC ], ], 'alias' => [ 'asc' => [ 'tax_group_lang.alias' => SORT_ASC ], 'desc' => [ 'tax_group_lang.alias' => SORT_DESC ], ], 'description' => [ 'asc' => [ 'tax_group_lang.description' => SORT_ASC ], 'desc' => [ 'tax_group_lang.description' => SORT_DESC ], ], ], ], ] ); $this->load($params); if (!is_null($level)) { $this->level = $level; } 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->andFilterWhere( [ 'id' => $this->id, 'is_filter' => $this->is_filter, 'level' => $this->level, 'sort' => $this->sort, ] ) ->andFilterWhere( [ 'ilike', 'tax_group_lang.title', $this->groupName, ] ) ->andFilterWhere( [ 'ilike', 'tax_group_lang.alias', $this->alias, ] ) ->andFilterWhere( [ 'ilike', 'tax_group_lang.description', $this->description, ] ); return $dataProvider; } }