$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([ 'specialization_id' => $this->specialization_id, 'specialization_pid' => !empty($this->specialization_parent_name) ? array_keys(Specialization::find()->select('specialization_id')->FilterWhere(['like', 'specialization_name',$this->specialization_parent_name])->asArray()->indexBy('specialization_id')->all()) : $this->specialization_parent_name ]); $query->andFilterWhere(['like', 'specialization_name', $this->specialization_name]); return $dataProvider; } }