joinWith(['road', 'region', 'organization', 'roadDirection']); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); $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([ 'road_service_id' => $this->road_service_id, 'road_id' => $this->road_id, 'region_id' => $this->region_id, 'begin' => $this->begin, 'end' => $this->end, 'road_direction_id' => $this->road_direction_id, 'organization_id' => $this->organization_id, 'year_begin' => $this->year_begin, ]); return $dataProvider; } }