public function createTermEntity($iTermId, $iEntityId, $iEntityType) { $oTermEntity = new AM_Model_Db_TermEntity(); $oTermEntity->term = $iTermId; $oTermEntity->entity = $iEntityId; $oTermEntity->entity_type = $iEntityType; $oTermEntity->save(); return $oTermEntity; }
public function copyToIssue(AM_Model_Db_Issue $oIssueTo) { $oVocabulary = AM_Model_Db_Table_Abstract::factory('application')->findOneBy('id', $oIssueTo->application)->getVocabularyTag(); $oTag = AM_Model_Db_Table_Abstract::factory('term')->findOneBy('id', $this->term); $oNewTag = AM_Model_Db_Table_Abstract::factory('term')->findOneBy(array('title' => $oTag->title, 'vocabulary' => $oVocabulary->id)); if (empty($oNewTag)) { $oNewTag = $oVocabulary->createTag($oTag->title); } $oNewTermEntity = new AM_Model_Db_TermEntity(); $oNewTermEntity->term = $oNewTag->id; $oNewTermEntity->entity = $oIssueTo->id; $oNewTermEntity->entity_type = $this->entity_type; $oNewTermEntity->save(); return $oNewTermEntity; }