예제 #1
0
 /**
  * @return TaxonomyTerm[]|array
  */
 protected function getTerms()
 {
     if (empty($this->_terms)) {
         $vocabularies = TaxonomyVocabulary::getModelsArray();
         if (isset($vocabularies[$this->vocabularyName])) {
             $this->_terms = TaxonomyTermHierarchy::getTree($vocabularies[$this->vocabularyName]->id);
         }
     }
     return $this->_terms;
 }
예제 #2
0
 /**
  * @return TaxonomyTerm[]
  */
 public function getTree()
 {
     return TaxonomyTermHierarchy::getTree($this->id);
 }
예제 #3
0
 public function afterSave($insert, $changedAttributes)
 {
     TaxonomyTermHierarchy::addChild($this->id, $this->vid, $this->getParent() ? $this->getParent()->id : 0);
     parent::afterSave($insert, $changedAttributes);
 }