Exemple #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Death::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(['death_id' => $this->death_id, 'age' => $this->age]);
     $query->andFilterWhere(['like', 'hn', $this->hn])->andFilterWhere(['like', 'sex', $this->sex])->andFilterWhere(['like', 'addre', $this->addre])->andFilterWhere(['like', 'death_out_place', $this->death_out_place])->andFilterWhere(['like', 'send_by_id', $this->send_by_id])->andFilterWhere(['like', 'cpr', $this->cpr])->andFilterWhere(['like', 'ward', $this->ward])->andFilterWhere(['like', 'symptoms_refer', $this->symptoms_refer])->andFilterWhere(['like', 'death_af48hr', $this->death_af48hr])->andFilterWhere(['like', 'case_refer', $this->case_refer]);
     return $dataProvider;
 }
Exemple #2
0
 /**
  * Finds the Death model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Death the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Death::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }