From cebc19ef236aac2968d2ffccfcff9b975b63fa8d Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 23 Jun 2025 03:33:38 +0200 Subject: fullcalendar --- src/model/EventDTO.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/model/EventDTO.php (limited to 'src/model/EventDTO.php') diff --git a/src/model/EventDTO.php b/src/model/EventDTO.php new file mode 100644 index 0000000..8d33733 --- /dev/null +++ b/src/model/EventDTO.php @@ -0,0 +1,49 @@ +id = $event->getId(); + $this->title = $event->getTitle(); + $this->description = $event->getDescription() ?? ''; // renvoie $event->getDescription() si existe et ne vaut pas "null" + $this->allDay = $event->isAllDay(); + $this->color = $event->getColor(); + + if($this->allDay){ + $this->start = $event->getStart()->format('Y-m-d'); + $this->end = $event->getEnd()->format('Y-m-d'); + } + else{ + $this->start = $event->getStart()->format('Y-m-d\TH:i:s\Z'); + $this->end = $event->getEnd()->format('Y-m-d\TH:i:s\Z'); + } + } + + public function toArray(): array + { + return [ + 'id' => $this->id, + 'title' => $this->title, + 'description' => $this->description, + 'start' => $this->start, + 'end' => $this->end, + 'allDay' => $this->allDay, + 'color' => $this->color, + ]; + } +} -- cgit v1.2.3