joinWith(['road', 'region', 'settlement', 'settlementLocation']); // 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([ 'settlement_address_link_id' => $this->settlement_address_link_id, 'road_id' => $this->road_id, 'region_id' => $this->region_id, 'begin' => $this->begin, 'end' => $this->end, 'settlement_location_id' => $this->settlement_location_id, 'settlement_id' => $this->settlement_id, 'distance' => $this->distance, ]); return $dataProvider; } }