aboutsummaryrefslogtreecommitdiff
path: root/src/model/EventDTO.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-10-23 00:47:32 +0200
committerpolo <ordipolo@gmx.fr>2026-10-23 00:47:32 +0200
commitf27cca08ff786ceff1870147f6d6bad14d71117f (patch)
treed36597a72025313d6faf4ed228755fa267ebe2f6 /src/model/EventDTO.php
parentc7309f900ef05bd5cb313110ec159b761af394ec (diff)
downloadcms-f27cca08ff786ceff1870147f6d6bad14d71117f.tar.gz
cms-f27cca08ff786ceff1870147f6d6bad14d71117f.tar.bz2
cms-f27cca08ff786ceff1870147f6d6bad14d71117f.zip
dossiers avec majuscule, namespace pour toutes les classes, autoload psr-4, UserDataService::createZip déplacé dans Backup
Diffstat (limited to 'src/model/EventDTO.php')
-rw-r--r--src/model/EventDTO.php51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/model/EventDTO.php b/src/model/EventDTO.php
deleted file mode 100644
index 6dd3722..0000000
--- a/src/model/EventDTO.php
+++ /dev/null
@@ -1,51 +0,0 @@
1<?php
2// src/model/EventDTO.php
3//
4// classe de données JSONifiable compatible avec fullcalendar
5// servira éventuellement pour l'import/export de fichiers .ics
6
7declare(strict_types=1);
8
9use App\Entity\Event;
10
11class EventDTO
12{
13 public int $id;
14 public string $title;
15 public string $start;
16 public string $end;
17 public bool $allDay;
18 public ?string $color;
19 public string $description;
20
21 public function __construct(Event $event)
22 {
23 $this->id = $event->getId();
24 $this->title = $event->getTitle();
25 $this->description = $event->getDescription() ?? ''; // renvoie $event->getDescription() si existe et ne vaut pas "null"
26 $this->allDay = $event->isAllDay();
27 $this->color = $event->getColor();
28
29 if($this->allDay){
30 $this->start = $event->getStart()->format('Y-m-d');
31 $this->end = $event->getEnd()->format('Y-m-d');
32 }
33 else{
34 $this->start = $event->getStart()->format('Y-m-d\TH:i:s\Z');
35 $this->end = $event->getEnd()->format('Y-m-d\TH:i:s\Z');
36 }
37 }
38
39 public function toArray(): array
40 {
41 return [
42 'id' => $this->id,
43 'title' => $this->title,
44 'description' => $this->description,
45 'start' => $this->start,
46 'end' => $this->end,
47 'allDay' => $this->allDay,
48 'color' => $this->color,
49 ];
50 }
51}