diff options
Diffstat (limited to 'app/php/dto/CalendarGroupDTO.php')
-rw-r--r-- | app/php/dto/CalendarGroupDTO.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/php/dto/CalendarGroupDTO.php b/app/php/dto/CalendarGroupDTO.php index a03afde..5f83a71 100644 --- a/app/php/dto/CalendarGroupDTO.php +++ b/app/php/dto/CalendarGroupDTO.php @@ -6,10 +6,12 @@ Prado::using('Application.dto.CalendarDTO'); class CalendarGroupDTO { public $Name; + public $Priority; public $Calendars = []; public function loadRecord(Category $categoryRecord, array $calendars) { $this->Name = $categoryRecord->Name; + $this->Priority = $categoryRecord->Priority; $this->Calendars = array_map( function($calendarRecord) { $dto = new CalendarDTO(); @@ -28,6 +30,10 @@ class CalendarGroupDTO { public static function __compare(CalendarGroupDTO $cat1, CalendarGroupDTO $cat2) { + $cmp = ($cat1->Priority ?: PHP_MAX_INT) - ($cat2->Priority ?: PHP_MAX_INT); + if ($cmp !== 0) { + return $cmp; + } return strcmp($cat1->Name, $cat2->Name); } |