1 | <?php |
||
8 | class DtoEvent implements \JsonSerializable |
||
9 | { |
||
10 | /** |
||
11 | * @Assert\NotBlank() |
||
12 | */ |
||
13 | private $user; |
||
14 | |||
15 | private $summary; |
||
16 | |||
17 | private $description; |
||
18 | |||
19 | private $location; |
||
20 | |||
21 | /** |
||
22 | * @Assert\NotBlank() |
||
23 | */ |
||
24 | private $start; |
||
25 | |||
26 | /** |
||
27 | * @Assert\NotBlank() |
||
28 | */ |
||
29 | private $end; |
||
30 | |||
31 | private $googleEventId; |
||
32 | |||
33 | public function __construct(\Google_Service_Calendar_Event $event = null) |
||
45 | |||
46 | public function jsonSerialize() |
||
47 | { |
||
48 | $description = json_decode($this->description, true); |
||
49 | $users = []; |
||
50 | foreach ($description['user'] as $user) { |
||
51 | $users[] = $user; |
||
52 | } |
||
53 | return [ |
||
54 | 'user' => $users, |
||
55 | 'title' => $this->summary, |
||
56 | 'description' => $description['description'], |
||
57 | 'location' => $this->location, |
||
58 | 'start' => $this->start->dateTime, |
||
59 | 'end' => $this->end->dateTime, |
||
60 | 'id' => $this->googleEventId, |
||
61 | ]; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @return mixed |
||
66 | */ |
||
67 | public function getSummary() |
||
71 | |||
72 | /** |
||
73 | * @param mixed $summary |
||
74 | */ |
||
75 | public function setSummary($summary) |
||
79 | |||
80 | /** |
||
81 | * @return mixed |
||
82 | */ |
||
83 | public function getDescription() |
||
87 | |||
88 | /** |
||
89 | * @param mixed $description |
||
90 | */ |
||
91 | public function setDescription($description) |
||
95 | |||
96 | /** |
||
97 | * @return mixed |
||
98 | */ |
||
99 | public function getLocation() |
||
103 | |||
104 | /** |
||
105 | * @param mixed $location |
||
106 | */ |
||
107 | public function setLocation($location) |
||
111 | |||
112 | /** |
||
113 | * @return mixed |
||
114 | */ |
||
115 | public function getStart() |
||
119 | |||
120 | /** |
||
121 | * @param mixed $start |
||
122 | */ |
||
123 | public function setStart($start) |
||
127 | |||
128 | /** |
||
129 | * @return mixed |
||
130 | */ |
||
131 | public function getEnd() |
||
135 | |||
136 | /** |
||
137 | * @param mixed $end |
||
138 | */ |
||
139 | public function setEnd($end) |
||
143 | |||
144 | /** |
||
145 | * @return User |
||
146 | */ |
||
147 | public function getUser() |
||
151 | |||
152 | /** |
||
153 | * @param User $user |
||
154 | * |
||
155 | * @return $this |
||
156 | */ |
||
157 | public function setUser($user) |
||
163 | |||
164 | /** |
||
165 | * @return mixed |
||
166 | */ |
||
167 | public function getGoogleEventId() |
||
171 | |||
172 | /** |
||
173 | * @param mixed $googleEventId |
||
174 | * |
||
175 | * @return $this |
||
176 | */ |
||
177 | public function setGoogleEventId($googleEventId) |
||
183 | } |
||
184 |