From 33f9cdbc976e0f97c3dd24658dc7d0097497c6d7 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 28 Sep 2014 18:23:21 -0400 Subject: Add support for Github Issue Webhooks --- app/Model/Task.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'app/Model/Task.php') diff --git a/app/Model/Task.php b/app/Model/Task.php index 3e19555f..54dc0a2f 100644 --- a/app/Model/Task.php +++ b/app/Model/Task.php @@ -82,6 +82,7 @@ class Task extends Base $sql = ' SELECT tasks.id, + tasks.reference, tasks.title, tasks.description, tasks.date_creation, @@ -118,7 +119,7 @@ class Task extends Base } /** - * Fetch one task + * Fetch a task by the id * * @access public * @param integer $task_id Task id @@ -129,6 +130,18 @@ class Task extends Base return $this->db->table(self::TABLE)->eq('id', $task_id)->findOne(); } + /** + * Fetch a task by the reference (external id) + * + * @access public + * @param string $reference Task reference + * @return array + */ + public function getByReference($reference) + { + return $this->db->table(self::TABLE)->eq('reference', $reference)->findOne(); + } + /** * Count all tasks for a given project and status * @@ -200,6 +213,7 @@ class Task extends Base '(SELECT count(*) FROM task_has_subtasks WHERE task_id=tasks.id) AS nb_subtasks', '(SELECT count(*) FROM task_has_subtasks WHERE task_id=tasks.id AND status=2) AS nb_completed_subtasks', 'tasks.id', + 'tasks.reference', 'tasks.title', 'tasks.description', 'tasks.date_creation', -- cgit v1.2.3