コード例 #1
0
ファイル: EducationSearch.php プロジェクト: kocapb/library
 /**
  * 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;
 }
コード例 #2
0
ファイル: UserController.php プロジェクト: kocapb/library
 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;
 }