/** * Updates an existing TravellersProfile 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); $travellerhelp = TravellerHelp::find()->where(['traveller_id' => $model->traveller_id])->one(); $travellerlanguages = TravellersLanguages::find()->where(['traveller_id' => $model->traveller_id])->one(); if ($model->load(Yii::$app->request->post()) && $model->save()) { if (count($travellerlanguages) > 0) { return $this->redirect(['travellerslanguages/update', 'id' => $model->traveller_id]); } else { return $this->redirect(['travellerslanguages/create', 'traveller_id' => $model->traveller_id]); } } else { return $this->render('update', ['model' => $model, 'traveller_id' => $model->traveller_id, 'travellerhelp' => $travellerhelp, 'travellerlanguages' => $travellerlanguages]); } }
/** * Finds the TravellerHelp model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return TravellerHelp the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = TravellerHelp::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }