Example #1
0
 public function uninstall()
 {
     //drop the data table
     //$this->getDb()->createCommand()->dropTable($this->getTable())->execute();
     //delete the term itself
     $model = TaxonomyDef::findOne($this->id);
     $model->delete();
 }
Example #2
0
 /**
  * @param $termName
  * @return BaseTerm
  * @throws InvalidConfigException
  * @throws TermNotDefinedException
  */
 public function getTerm($termName, $reload = false)
 {
     if (!isset($this->_taxonomy[$termName]) || $reload) {
         $tax = TaxonomyDef::findOne(['name' => $termName]);
         \Yii::getLogger()->log("Initialising term {$termName}", Logger::LEVEL_INFO, 'nkostadinov.taxonomy.terms');
         $this->_taxonomy[$termName] = \Yii::createObject($tax->attributes);
     }
     return $this->_taxonomy[$termName];
 }
Example #3
0
 /**
  * Finds the TaxonomyDef model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TaxonomyDef the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TaxonomyDef::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }