public function searchEntranceExam($params) { $pageSize = Yii::$app->params['pageSize']; $query = EntranceExamForm::find(); $dataProvider->sort->attributes['id'] = ['asc' => ['id' => SORT_ASC], 'desc' => ['id' => SORT_DESC]]; $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => ['pageSize' => $pageSize]]); $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(['id' => $this->id, 'applicant_id' => $this->applicant_id, 'english' => $this->english, 'reading_skills' => $this->reading_skills, 'science' => $this->science, 'comprehension' => $this->comprehension, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'remarks', $this->remarks])->andFilterWhere(['like', 'recommendations', $this->recommendations]); return $dataProvider; }
/** * Finds the EntranceExamForm model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return EntranceExamForm the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = EntranceExamForm::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }