Exemple #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPersonal()
 {
     if (!$this->personal_id && !$this->isNewRecord) {
         $personal = new Personal();
         $personal->save();
         $this->updateAttributes(["personal_id" => $personal->id]);
     }
     return parent::getPersonal();
 }
 /**
  * Creates a new Personal model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Personal();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->idPersona]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }