/**
  * Finds the Report model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Report the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     $model = Report::find()->where(['id' => $id, 'patient_id' => Yii::$app->session->get('patient_id')])->one();
     if ($model) {
         return $model;
     } else {
         throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.'));
     }
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Report::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, 'patient_id' => $this->patient_id, 'operator_id' => $this->operator_id, 'date' => $this->date]);
     return $dataProvider;
 }
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getReport()
 {
     return $this->hasOne(Report::className(), ['id' => 'report_id']);
 }
示例#4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getReports()
 {
     return $this->hasMany(Report::className(), ['patient_id' => 'id']);
 }
示例#5
0
 /**
  * Finds the Report model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Report the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Report::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.'));
     }
 }
示例#6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getReports()
 {
     return $this->hasMany(Report::className(), ['operator_id' => 'id']);
 }