From 7c5b900bd83b6b9bdb5656eb169381ff46f8106a Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 20 Jun 2014 15:41:05 -0300 Subject: First API implementation --- app/Model/Task.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/Model/Task.php') diff --git a/app/Model/Task.php b/app/Model/Task.php index 70f1404c..09e2f4e4 100644 --- a/app/Model/Task.php +++ b/app/Model/Task.php @@ -108,6 +108,23 @@ class Task extends Base } } + /** + * Count all tasks for a given project and status + * + * @access public + * @param integer $project_id Project id + * @param array $status List of status id + * @return array + */ + public function getAll($project_id, array $status = array(self::STATUS_OPEN, self::STATUS_CLOSED)) + { + return $this->db + ->table(self::TABLE) + ->eq('project_id', $project_id) + ->in('is_active', $status) + ->findAll(); + } + /** * Count all tasks for a given project and status * -- cgit v1.2.3