Example #1
0
 /**
  * Creates a new TaxonomyDef model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new TaxonomyDef();
     $definitions = $this->getComponent()->getDefinitions();
     if ($model->load(Yii::$app->request->post())) {
         //install the term
         $term = Yii::createObject($model->attributes);
         //$this->getComponent()->getTerm($model->name);
         $term->install();
         $migration = new Migrator('migrate', Yii::$app);
         $messsage = $migration->run($term->migration, $term->migrationPath);
         Yii::$app->session->setFlash('info', $messsage, true);
         return $this->redirect(['index', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'definitions' => $definitions]);
     }
 }