From e4606f2d87be0073bcba02fc5878b768260f4a7f Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 12 Mar 2016 12:35:30 +0100 Subject: * calendar group DTOs --- app/php/dto/CalendarDTO.php | 19 +++++++++++++++++++ app/php/dto/CalendarGroupDTO.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 app/php/dto/CalendarDTO.php create mode 100644 app/php/dto/CalendarGroupDTO.php diff --git a/app/php/dto/CalendarDTO.php b/app/php/dto/CalendarDTO.php new file mode 100644 index 0000000..302fcf4 --- /dev/null +++ b/app/php/dto/CalendarDTO.php @@ -0,0 +1,19 @@ +ID = $calendarRecord->UID; + $this->Name = $calendarRecord->Name; + $this->Website = $calendarRecord->Website; + } + +} + +?> diff --git a/app/php/dto/CalendarGroupDTO.php b/app/php/dto/CalendarGroupDTO.php new file mode 100644 index 0000000..3adb6c1 --- /dev/null +++ b/app/php/dto/CalendarGroupDTO.php @@ -0,0 +1,30 @@ +Name = $categoryRecord->Name; + $this->Calendars = array_map( + function($calendarRecord) { + $dto = new CalendarDTO(); + $dto->loadRecord($calendarRecord); + return $dto; + }, + array_filter( + $calendars, + function($calendarRecord) use($categoryRecord) { + return $categoryRecord->ID == $calendarRecord->CategoryID; + } + ) + ); + } + +} + +?> -- cgit v1.2.3