コード例 #1
0
ファイル: Vocabulary.php プロジェクト: pansot2/PadCMS-backend
 /**
  * Create Tag vocabulary for application
  * @param AM_Model_Db_Application $oApplication
  * @return AM_Model_Db_Vocabulary
  */
 public function createTagVocabulary(AM_Model_Db_Application $oApplication)
 {
     $oVocabulary = new AM_Model_Db_Vocabulary();
     $oVocabulary->title = 'Tag vocabulary';
     $oVocabulary->has_hierarchy = 0;
     $oVocabulary->multiple = 1;
     $oVocabulary->application = $oApplication->id;
     $oVocabulary->save();
     return $oVocabulary;
 }
コード例 #2
0
 /**
  * Fetch Tag vocabulary
  * @return AM_Model_Db_Application
  */
 public function fetchVocabularyTag()
 {
     $oVocabularyTable = AM_Model_Db_Table_Abstract::factory('vocabulary');
     /* @var $oVocabularyTable AM_Model_Db_Table_Vocabulary */
     $this->_oVocabularyTag = $oVocabularyTable->findOneBy(array('has_hierarchy' => 0, 'multiple' => 1, 'application' => $this->id));
     if (empty($this->_oVocabularyTag)) {
         //Create tag vocabulary
         $this->_oVocabularyTag = $oVocabularyTable->createTagVocabulary($this);
     }
     $this->_oVocabularyTag->fetchTags();
     return $this;
 }