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