/**
  * Updates an existing TravellerHelp 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);
     $descriptionmodel = TravellerDescription::find()->where(['traveller_id' => $model->traveller_id])->one();
     $profilemodel = TravellersProfile::find()->where(['traveller_id' => $model->traveller_id])->one();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         if (count($profilemodel) > 0) {
             return $this->redirect(['travellersprofile/update', 'id' => $profilemodel->id]);
         } else {
             return $this->redirect(['travellersprofile/create', 'traveller_id' => $model->traveller_id]);
         }
     } else {
         return $this->render('update', ['model' => $model, 'traveller_id' => $model->traveller_id, 'descriptionmodel' => $descriptionmodel, 'profilemodel' => $profilemodel]);
     }
 }
 /**
  * Updates an existing TravellersLanguages model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $traveller = \frontend\models\Travellers::findOne($id);
     $model = new TravellersLanguages();
     $model->mother_language = Yii::$app->commoncomponent->getLanguagesArray($traveller->motherLanguages);
     $model->fluent_language = Yii::$app->commoncomponent->getLanguagesArray($traveller->fluentLanguages);
     $model->learning_language = Yii::$app->commoncomponent->getLanguagesArray($traveller->learningLanguages);
     $Languages = Yii::$app->commoncomponent->getAllLanguagesArray();
     $travellerprofile = TravellersProfile::find()->where(['traveller_id' => $id])->one();
     $travellerfood = TravellersFood::find()->where(['traveller_id' => $id])->one();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->commoncomponent->deleteTravellerLanguages($id);
         Yii::$app->commoncomponent->saveTravellerLanguages($model->mother_language, $id, 'mother_language');
         Yii::$app->commoncomponent->saveTravellerLanguages($model->fluent_language, $id, 'fluent');
         Yii::$app->commoncomponent->saveTravellerLanguages($model->learning_language, $id, 'learning');
         if (count($travellerfood) > 0) {
             return $this->redirect(['travellersfood/update', 'id' => $travellerfood->id]);
         } else {
             return $this->redirect(['travellersfood/create', 'traveller_id' => $traveller_id]);
         }
     } else {
         return $this->render('update', ['model' => $model, 'traveller_id' => $id, 'travellerprofile' => $travellerprofile, 'Languages' => $Languages, 'travellerfood' => $travellerfood]);
     }
 }
 /**
  * Finds the TravellersProfile model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TravellersProfile the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TravellersProfile::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }