summaryrefslogtreecommitdiff
path: root/app/Model/Task.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/Task.php')
-rw-r--r--app/Model/Task.php16
1 files changed, 15 insertions, 1 deletions
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
@@ -130,6 +131,18 @@ class Task extends Base
}
/**
+ * 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
*
* @access public
@@ -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',