Ejemplo n.º 1
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)
 {
     $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.'));
     }
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getReport()
 {
     return $this->hasOne(Report::className(), ['id' => 'report_id']);
 }
Ejemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getReports()
 {
     return $this->hasMany(Report::className(), ['patient_id' => 'id']);
 }
Ejemplo n.º 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.'));
     }
 }
Ejemplo n.º 6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getReports()
 {
     return $this->hasMany(Report::className(), ['operator_id' => 'id']);
 }