Example #1
0
 /**
  * Updates an existing ClnTranInj model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $modelClnDiagnose = ClnDiagnose::findOne(['TRAN_INJ_GEN_NO' => $id]);
     $sportItems = ArrayHelper::map(ClnSport::find()->all(), 'SPORT_GEN_NO', 'SPORT_NAME');
     $causeItems = ArrayHelper::map(ClnCauseInj::find()->all(), 'CAUSE_GEN_NO', 'CAUSE_NAME');
     $bondItems = ArrayHelper::map(ClnBoundaryInj::find()->all(), 'BOND_GEN_NO', 'BOND_NAME');
     $searchClnMedicineTestSearchModel = new \app\models\ClnMedicineTestSearch();
     $queryParams = array();
     $queryParams = Yii::$app->request->queryParams;
     $queryParams['ClnMedicineTestSearch']['TRAN_INJ_GEN_NO'] = $id;
     $dataClnMedicineTestProvider = $searchClnMedicineTestSearchModel->search($queryParams);
     //Yii::$app->request->queryParams);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->TRAN_INJ_GEN_NO]);
     } else {
         return $this->render('update', ['model' => $model, 'modelClnDiagnose' => $modelClnDiagnose, 'sportItems' => $sportItems, 'causeItems' => $causeItems, 'bondItems' => $bondItems, 'searchClnMedicineTestSearchModel' => $searchClnMedicineTestSearchModel, 'dataClnMedicineTestProvider' => $dataClnMedicineTestProvider]);
     }
 }
 /**
  * Finds the ClnDiagnose model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return ClnDiagnose the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = ClnDiagnose::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }