Create TaskDuplication model

This commit is contained in:
Frédéric Guillot
2014-11-23 18:23:20 -05:00
parent f684602ebe
commit 81df22de23
13 changed files with 556 additions and 282 deletions

View File

@@ -45,6 +45,34 @@ class Category extends Base
return $this->db->table(self::TABLE)->eq('id', $category_id)->findOne();
}
/**
* Get the category name by the id
*
* @access public
* @param integer $category_id Category id
* @return string
*/
public function getNameById($category_id)
{
return $this->db->table(self::TABLE)->eq('id', $category_id)->findOneColumn('name') ?: '';
}
/**
* Get a category id by the project and the name
*
* @access public
* @param integer $project_id Project id
* @param string $category_name Category name
* @return integer
*/
public function getIdByName($project_id, $category_name)
{
return (int) $this->db->table(self::TABLE)
->eq('project_id', $project_id)
->eq('name', $category_name)
->findOneColumn('id');
}
/**
* Return the list of all categories
*