コード例 #1
0
 /**
  * Creates a new ClnTranInjTest model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new ClnTranInjTest();
     $clnRegisterModel = new ClnRegister();
     if ($model->load(Yii::$app->request->post())) {
         $model->TRAN_INJ_GEN_NO = ClnTranInjTest::getNewID();
         //new \yii\db\Expression('CLN_TRAN_INJ_SEQ.nextval') ;
         $model->TRAN_INJ_DATE = new \yii\db\Expression('SYSDATE');
         $model->CREATE_BY = 'admin';
         $model->CREATE_DATE = new \yii\db\Expression('SYSDATE');
         $model->UPDATE_BY = 'admin';
         $model->UPDATE_DATE = new \yii\db\Expression('SYSDATE');
         if ($model->save()) {
             return $this->redirect(['update', 'id' => $model->TRAN_INJ_GEN_NO]);
         } else {
             $data['result'] = print_r($model->getErrors(), 1);
             header('Content-type: application/json');
             echo json_encode($data);
         }
     } else {
         return $this->render('create', ['model' => $model, 'clnRegisterModel' => $clnRegisterModel]);
     }
 }