diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-11-23 18:23:20 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-11-23 18:23:20 -0500 |
commit | 81df22de238bc36d810b95ad67a4426db095fbab (patch) | |
tree | 53231a3d46b6b7c54eaec515016247984cf7a4e4 /app/Model/Category.php | |
parent | f684602ebedc0adc4a329693ba524ad46d5cd8b0 (diff) |
Create TaskDuplication model
Diffstat (limited to 'app/Model/Category.php')
-rw-r--r-- | app/Model/Category.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/Model/Category.php b/app/Model/Category.php index 7fed50a3..65fd0c56 100644 --- a/app/Model/Category.php +++ b/app/Model/Category.php @@ -46,6 +46,34 @@ class Category extends Base } /** + * 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 * * @access public |