public static function getModelTags(Storage_Db $db, Model_Tagged $model) { $table = $model->getTable(); $objid = $model->getId(); $result = $db->select(array('tag_relations', 'tags'), "tags.*", "tag_relations.obj_type = '{$table}' and tag_relations.obj_id = '{$objid}' and tag_relations.tag_id = tags.id"); return new Model_List_Tag($db, $result); }
public function untagModel(Model_Tagged $model, $alltags = false) { $cond = array('obj_type' => $model->getTable(), 'obj_id' => $model->getId()); if (!$alltags) { $cond['tag_id'] = $this->getId(); } $this->_db->delete('tag_relations', $cond); }