summaryrefslogtreecommitdiff
path: root/app/Model/Base.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/Base.php')
-rw-r--r--app/Model/Base.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/Model/Base.php b/app/Model/Base.php
index 784545fe..51ae782d 100644
--- a/app/Model/Base.php
+++ b/app/Model/Base.php
@@ -143,4 +143,23 @@ abstract class Base extends \Core\Base
'url' => $this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])),
);
}
+
+ /**
+ * Group a collection of records by a column
+ *
+ * @access public
+ * @param array $collection
+ * @param string $column
+ * @return array
+ */
+ public function groupByColumn(array $collection, $column)
+ {
+ $result = array();
+
+ foreach ($collection as $item) {
+ $result[$item[$column]][] = $item;
+ }
+
+ return $result;
+ }
}