public function saveTravellerLanguages($dataArray, $traveller_id, $type)
 {
     foreach ($dataArray as $record) {
         $modelInsert = new TravellersLanguages();
         $modelInsert->traveller_id = $traveller_id;
         $modelInsert->language = $record;
         $modelInsert->type = $type;
         $modelInsert->save(false);
     }
     return TRUE;
 }
 /**
  * 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 TravellersLanguages model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TravellersLanguages the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TravellersLanguages::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }