Ejemplo n.º 1
0
 public function actionCreate()
 {
     $model = new Country();
     $model->setScenario("create");
     if ($model->load(Yii::$app->request->post(), "Country") && $model->validate()) {
         if (CountryService::create($model)) {
             $this->redirect(['all']);
         }
     }
     return $this->render('create', ['model' => $model]);
 }
Ejemplo n.º 2
0
 /**
  * @return Country
  */
 public function getCountry()
 {
     return $this->hasOne(Country::className(), ['id' => 'countryId']);
 }
Ejemplo n.º 3
0
 /**
  * @param integer $id
  * @return Country
  */
 public static function findById($id)
 {
     return Country::findById($id);
 }