/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = WorkloadEvent2::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(['ref' => $this->ref, 'event_date' => $this->event_date, 'bed_no' => $this->bed_no, 'cpr' => $this->cpr, 'doctor_ref' => $this->doctor_ref, 'last_update' => $this->last_update]); $query->andFilterWhere(['like', 'event_period', $this->event_period])->andFilterWhere(['like', 'hn', $this->hn])->andFilterWhere(['like', 'an', $this->an])->andFilterWhere(['like', 'ward', $this->ward])->andFilterWhere(['like', 'bed_type', $this->bed_type])->andFilterWhere(['like', 'pt_type', $this->pt_type])->andFilterWhere(['like', 'admit_type', $this->admit_type])->andFilterWhere(['like', 'disc_type', $this->disc_type])->andFilterWhere(['like', 'disability', $this->disability])->andFilterWhere(['like', 'operate', $this->operate])->andFilterWhere(['like', 'prepare', $this->prepare])->andFilterWhere(['like', 'uti', $this->uti])->andFilterWhere(['like', 'vap', $this->vap])->andFilterWhere(['like', 'phleb', $this->phleb])->andFilterWhere(['like', 'user', $this->user])->andFilterWhere(['like', 'cutdown', $this->cutdown]); return $dataProvider; }
/** * Finds the WorkloadEvent2 model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return WorkloadEvent2 the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = WorkloadEvent2::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }