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]); }
/** * @return Country */ public function getCountry() { return $this->hasOne(Country::className(), ['id' => 'countryId']); }
/** * @param integer $id * @return Country */ public static function findById($id) { return Country::findById($id); }