/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Education::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
protected function getEducationsView() { /** @var Education[] $education */ $educations = Education::find()->all(); if (!$educations) { return []; } $result = []; foreach ($educations as $education) { $result[$education->id] = $education->name; } return $result; }