/**
  * Finds the Region model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Region the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findRegion($id)
 {
     if (($model = Region::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @inheritdoc
  */
 public function validateRegion()
 {
     if ($this->region_id !== null) {
         $region = Region::findOne($this->region_id);
         if ($region === null) {
             $this->addError('zone_id', Yii::t('location', 'Region with id {[id]} doesn\'t exist', ['id' => $this->region_id]));
             return false;
         }
         $this->country_id = $region->country_id;
     }
     return true;
 }