$query, ]); $data = [ 'OptionSearch' => [ 'model' => 'Main' ] ]; $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->andWhere(['parent_id' => null]); $query->andFilterWhere([ 'option_id' => $this->option_id, 'model_id' => $this->model_id, 'parent_id' => $this->parent_id, ]); $query->andFilterWhere(['like', 'model', $this->model]) ->andFilterWhere(['like', 'name', $this->name]) ->andFilterWhere(['like', 'template', $this->template]); return $dataProvider; } }