summaryrefslogtreecommitdiff
path: root/app/Model/Comment.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-10-11 18:21:54 -0400
committerFrederic Guillot <fred@kanboard.net>2015-10-11 18:21:54 -0400
commitffe615d2018bdfb789667715bbde062dd696d320 (patch)
tree7835b6b1bb2b78cbdd601dcdea6641d34acdb561 /app/Model/Comment.php
parentc77c9443e9426967a57fb964a8f61a92b1a69eba (diff)
Add comments sorting
Diffstat (limited to 'app/Model/Comment.php')
-rw-r--r--app/Model/Comment.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/Model/Comment.php b/app/Model/Comment.php
index e3ffc1be..c1c800c3 100644
--- a/app/Model/Comment.php
+++ b/app/Model/Comment.php
@@ -34,9 +34,10 @@ class Comment extends Base
*
* @access public
* @param integer $task_id Task id
+ * @param string $sorting ASC/DESC
* @return array
*/
- public function getAll($task_id)
+ public function getAll($task_id, $sorting = 'ASC')
{
return $this->db
->table(self::TABLE)
@@ -51,7 +52,7 @@ class Comment extends Base
User::TABLE.'.email'
)
->join(User::TABLE, 'id', 'user_id')
- ->orderBy(self::TABLE.'.date_creation', 'ASC')
+ ->orderBy(self::TABLE.'.date_creation', $sorting)
->eq(self::TABLE.'.task_id', $task_id)
->findAll();
}