summaryrefslogtreecommitdiff
path: root/app/php/facades
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-05-10 00:27:47 +0200
committeremkael <emkael@tlen.pl>2016-05-10 00:27:47 +0200
commita9726eec11d092583242259aea8b88f1085ad922 (patch)
tree4e234e93857c01c945c74b739f324bd68b228e01 /app/php/facades
parent668ce7487a1c61438213e9efb705c5c804aace8b (diff)
* switching to DTO in getCategories from CalendarFacade
Diffstat (limited to 'app/php/facades')
-rw-r--r--app/php/facades/CalendarFacade.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/php/facades/CalendarFacade.php b/app/php/facades/CalendarFacade.php
index b15eac3..5f24e28 100644
--- a/app/php/facades/CalendarFacade.php
+++ b/app/php/facades/CalendarFacade.php
@@ -143,7 +143,16 @@ class CalendarFacade extends Facade {
}
public function getCategories() {
- return Category::finder()->findAll('ORDER BY name ASC');
+ $categories = array_map(
+ function($record) {
+ $dto = new CalendarGroupDTO();
+ $dto->loadRecord($record, []);
+ return $dto;
+ },
+ Category::finder()->findAll()
+ );
+ usort($categories, ['CalendarGroupDTO', '__compare']);
+ return $categories;
}
public function get($uid) {