コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = College::find();
     $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;
     }
     $query->andFilterWhere(['college_plan_id' => $this->college_plan_id]);
     $query->andFilterWhere(['like', 'school_plan_to_enroll_in', $this->school_plan_to_enroll_in])->andFilterWhere(['like', 'course_plan_to_take1', $this->course_plan_to_take1])->andFilterWhere(['like', 'course_plan_to_take2', $this->course_plan_to_take2]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getApplicantCollege()
 {
     return $this->hasOne(College::className(), ['college_plan_id' => 'applicant_college_id']);
 }