/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Phase::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(['id' => $this->id, 'applicant' => $this->applicant, 'checklist' => $this->checklist, 'points' => $this->points, 'school_attending' => $this->school_attending, 'date' => $this->date]); $query->andFilterWhere(['like', 'grade_screening', $this->grade_screening])->andFilterWhere(['like', 'screening_feedback', $this->screening_feedback])->andFilterWhere(['like', 'exam', $this->exam])->andFilterWhere(['like', 'interview', $this->interview])->andFilterWhere(['like', 'interview_feedback', $this->interview_feedback])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'remarks', $this->remarks])->andFilterWhere(['like', 'approved_by', $this->approved_by]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getPhases() { return $this->hasMany(Phase::className(), ['applicant' => 'id']); }
/** * Finds the Phase model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Phase the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Phase::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getPhases() { return $this->hasMany(Phase::className(), ['checklist' => 'id']); }