summaryrefslogtreecommitdiff
path: root/app/Model/Category.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-09-01 20:40:02 -0800
committerFrédéric Guillot <fred@kanboard.net>2014-09-01 20:40:02 -0800
commit457e181ffb915e36e5da77317a6c824e10f5d5b3 (patch)
treeeb5443ac4cdbd92278359fcd15d888752c70bc77 /app/Model/Category.php
parente6d0658a0eedeb6a641c003d1c492af0f9a7502c (diff)
Improve task duplication
Diffstat (limited to 'app/Model/Category.php')
-rw-r--r--app/Model/Category.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/Model/Category.php b/app/Model/Category.php
index 58841f9a..4f296944 100644
--- a/app/Model/Category.php
+++ b/app/Model/Category.php
@@ -21,6 +21,19 @@ class Category extends Base
const TABLE = 'project_has_categories';
/**
+ * Return true if a category exists for a given project
+ *
+ * @access public
+ * @param integer $category_id Category id
+ * @param integer $project_id Project id
+ * @return boolean
+ */
+ public function exists($category_id, $project_id)
+ {
+ return $this->db->table(self::TABLE)->eq('id', $category_id)->eq('project_id', $project_id)->count() > 0;
+ }
+
+ /**
* Get a category by the id
*
* @access public