1 | <?php |
||
30 | class PerformanceEvent extends AbstractPersonalTranslatable implements TranslatableInterface |
||
31 | { |
||
32 | use TimestampableTrait, BlameableEntity, DeletedByTrait; |
||
33 | |||
34 | /** |
||
35 | * @var integer |
||
36 | * |
||
37 | * @ORM\Column(name="id", type="integer") |
||
38 | * @ORM\Id |
||
39 | * @ORM\GeneratedValue(strategy="AUTO") |
||
40 | * |
||
41 | * @Serializer\Groups({"get_ticket"}) |
||
42 | * @Type("integer") |
||
43 | * @Expose |
||
44 | */ |
||
45 | private $id; |
||
46 | |||
47 | /** |
||
48 | * @var Performance |
||
49 | * |
||
50 | * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Performance", inversedBy="performanceEvents") |
||
51 | * |
||
52 | * @Serializer\Groups({"get_ticket"}) |
||
53 | * @Type("AppBundle\Entity\Performance") |
||
54 | * @Expose |
||
55 | */ |
||
56 | private $performance; |
||
57 | |||
58 | /** |
||
59 | * @var /Datetime |
||
60 | * |
||
61 | * @Assert\NotBlank() |
||
62 | * @ORM\Column(type="datetime") |
||
63 | * |
||
64 | * @Serializer\Groups({"get_ticket"}) |
||
65 | * @Type("DateTime") |
||
66 | * @Expose |
||
67 | */ |
||
68 | private $dateTime; |
||
69 | |||
70 | /** |
||
71 | * @var Venue |
||
72 | * |
||
73 | * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Venue", inversedBy="performanceEvents") |
||
74 | * |
||
75 | * @Serializer\Groups({"get_ticket"}) |
||
76 | * @Type("AppBundle\Entity\Venue") |
||
77 | * @Expose |
||
78 | */ |
||
79 | private $venue; |
||
80 | |||
81 | /** |
||
82 | * @var int |
||
83 | * |
||
84 | * @Serializer\Groups({"get_ticket"}) |
||
85 | * @Type("integer") |
||
86 | * @Expose |
||
87 | * @Accessor(getter="getYear") |
||
88 | */ |
||
89 | private $year; |
||
90 | |||
91 | /** |
||
92 | * @var int |
||
93 | * |
||
94 | * @Serializer\Groups({"get_ticket"}) |
||
95 | * @Expose |
||
96 | * @Accessor(getter="getMonth") |
||
97 | */ |
||
98 | private $month; |
||
99 | |||
100 | /** |
||
101 | * @var int |
||
102 | * |
||
103 | * @Serializer\Groups({"get_ticket"}) |
||
104 | * @Expose |
||
105 | * @Accessor(getter="getDay") |
||
106 | */ |
||
107 | private $day; |
||
108 | |||
109 | /** |
||
110 | * @var string |
||
111 | * |
||
112 | * @Serializer\Groups({"get_ticket"}) |
||
113 | * @Expose |
||
114 | * @Accessor(getter="getTime") |
||
115 | */ |
||
116 | private $time; |
||
117 | |||
118 | /** |
||
119 | * @var string |
||
120 | * |
||
121 | * @Serializer\Groups({"get_ticket"}) |
||
122 | * @ORM\Column(type="string", length=10, nullable=true) |
||
123 | * |
||
124 | * @Type("string") |
||
125 | * @Expose |
||
126 | */ |
||
127 | private $seriesNumber; |
||
128 | |||
129 | /** |
||
130 | * @var \DateTime |
||
131 | * @Assert\DateTime() |
||
132 | * @ORM\Column(type="datetime", nullable=true) |
||
133 | 4 | * |
|
134 | * @Serializer\Groups({"get_ticket"}) |
||
135 | 4 | * @Type("datetime") |
|
136 | * @Expose |
||
137 | 4 | */ |
|
138 | private $seriesDate; |
||
139 | |||
140 | /** |
||
141 | * @var boolean |
||
142 | * @ORM\Column(type="boolean", nullable=true, options={"default" : "0"}) |
||
143 | * |
||
144 | * @Serializer\Groups({"get_ticket"}) |
||
145 | 12 | * @Type("boolean") |
|
146 | * @Expose |
||
147 | 12 | */ |
|
148 | private $enableSale; |
||
149 | |||
150 | /** |
||
151 | * @var ArrayCollection|Translation[] |
||
152 | * |
||
153 | * @ORM\OneToMany( |
||
154 | * targetEntity="AppBundle\Entity\Translations\PerformanceEventTranslation", |
||
155 | * mappedBy="object", |
||
156 | 7 | * cascade={"persist", "remove"} |
|
157 | * ) |
||
158 | 7 | */ |
|
159 | protected $translations; |
||
160 | 7 | ||
161 | /** |
||
162 | * @var ArrayCollection|PriceCategory[] |
||
163 | * |
||
164 | * @Assert\Valid |
||
165 | * @ORM\OneToMany( |
||
166 | * targetEntity="AppBundle\Entity\PriceCategory", |
||
167 | * mappedBy="performanceEvent", |
||
168 | 14 | * cascade={"persist"}, |
|
169 | * orphanRemoval=true |
||
170 | 14 | * ) |
|
171 | */ |
||
172 | protected $priceCategories; |
||
173 | |||
174 | public function __construct() |
||
175 | { |
||
176 | parent::__construct(); |
||
177 | $this->priceCategories = new ArrayCollection(); |
||
178 | } |
||
179 | |||
180 | /** |
||
181 | * Unset translations |
||
182 | * |
||
183 | * @return PerformanceEvent |
||
184 | */ |
||
185 | public function unsetTranslations() |
||
186 | { |
||
187 | $this->translations = null; |
||
188 | |||
189 | return $this; |
||
190 | } |
||
191 | 6 | ||
192 | /** |
||
193 | 6 | * Get id |
|
194 | * |
||
195 | * @return integer |
||
196 | 2 | */ |
|
197 | public function getId() |
||
198 | 2 | { |
|
199 | 1 | return $this->id; |
|
200 | } |
||
201 | |||
202 | 1 | /** |
|
203 | * Set dateTime |
||
204 | * |
||
205 | * @param \DateTime $dateTime |
||
206 | * @return PerformanceEvent |
||
207 | */ |
||
208 | 4 | public function setDateTime($dateTime) |
|
209 | { |
||
210 | 4 | $this->dateTime = $dateTime; |
|
211 | |||
212 | return $this; |
||
213 | } |
||
214 | |||
215 | /** |
||
216 | * Get dateTime |
||
217 | * |
||
218 | * @return \DateTime |
||
219 | */ |
||
220 | public function getDateTime() |
||
221 | { |
||
222 | return $this->dateTime; |
||
223 | } |
||
224 | 4 | ||
225 | /** |
||
226 | 4 | * Set performance |
|
227 | * |
||
228 | * @param \AppBundle\Entity\Performance $performance |
||
229 | * @return PerformanceEvent |
||
230 | */ |
||
231 | public function setPerformance(\AppBundle\Entity\Performance $performance = null) |
||
232 | { |
||
233 | $this->performance = $performance; |
||
234 | |||
235 | return $this; |
||
236 | } |
||
237 | |||
238 | /** |
||
239 | * Get performance |
||
240 | 4 | * |
|
241 | * @return \AppBundle\Entity\Performance |
||
242 | 4 | */ |
|
243 | public function getPerformance() |
||
244 | { |
||
245 | return $this->performance; |
||
246 | } |
||
247 | |||
248 | public function __toString() |
||
249 | { |
||
250 | if ($this->getDateTime()) { |
||
251 | return $this->getDateTime()->format('d-m-Y H:i'); |
||
252 | } |
||
253 | |||
254 | return date("F j, Y, g:i a"); |
||
255 | } |
||
256 | 4 | ||
257 | /** |
||
258 | 4 | * @return mixed |
|
259 | */ |
||
260 | public function getYear() |
||
261 | { |
||
262 | return $this->getDateTime()->format('Y'); |
||
263 | } |
||
264 | |||
265 | /** |
||
266 | * @param mixed $year |
||
267 | */ |
||
268 | public function setYear($year) |
||
269 | { |
||
270 | $this->year = $year; |
||
271 | } |
||
272 | 6 | ||
273 | /** |
||
274 | 6 | * @return int |
|
275 | */ |
||
276 | public function getMonth() |
||
277 | { |
||
278 | return $this->getDateTime()->format('n'); |
||
279 | } |
||
280 | |||
281 | /** |
||
282 | * @param int $month |
||
283 | */ |
||
284 | public function setMonth($month) |
||
285 | { |
||
286 | $this->month = $month; |
||
287 | } |
||
288 | |||
289 | /** |
||
290 | * @return int |
||
291 | */ |
||
292 | public function getDay() |
||
296 | |||
297 | /** |
||
298 | * @param int $day |
||
299 | */ |
||
300 | public function setDay($day) |
||
304 | |||
305 | /** |
||
306 | * @return string |
||
307 | */ |
||
308 | public function getTime() |
||
312 | |||
313 | /** |
||
314 | * @param string $time |
||
315 | */ |
||
316 | public function setTime($time) |
||
320 | |||
321 | /** |
||
322 | * @return Venue |
||
323 | */ |
||
324 | public function getVenue() |
||
328 | |||
329 | /** |
||
330 | * @param Venue $venue |
||
331 | * @return PerformanceEvent |
||
332 | */ |
||
333 | public function setVenue(Venue $venue) |
||
339 | |||
340 | /** |
||
341 | * @param PriceCategory $priceCategory |
||
342 | * @return PerformanceEvent |
||
343 | */ |
||
344 | public function addPriceCategory(PriceCategory $priceCategory) |
||
350 | |||
351 | /** |
||
352 | * @param PriceCategory $priceCategory |
||
353 | */ |
||
354 | public function removePriceCategories(PriceCategory $priceCategory) |
||
358 | |||
359 | /** |
||
360 | * @return Collection |
||
361 | */ |
||
362 | public function getPriceCategories() |
||
366 | |||
367 | /** |
||
368 | * @param PriceCategory[]|ArrayCollection $priceCategory |
||
369 | */ |
||
370 | public function setPriceCategories($priceCategory) |
||
374 | |||
375 | /** |
||
376 | * @return string |
||
377 | */ |
||
378 | public function getSeriesNumber() |
||
379 | { |
||
380 | return $this->seriesNumber; |
||
381 | } |
||
382 | |||
383 | /** |
||
384 | * @param string $seriesNumber |
||
385 | */ |
||
386 | public function setSeriesNumber($seriesNumber) |
||
387 | { |
||
388 | $this->seriesNumber = $seriesNumber; |
||
389 | } |
||
390 | |||
391 | /** |
||
392 | * @return \DateTime |
||
393 | */ |
||
394 | public function getSeriesDate() |
||
395 | { |
||
396 | return $this->seriesDate; |
||
397 | } |
||
398 | |||
399 | /** |
||
400 | * @param \DateTime $seriesDate |
||
401 | */ |
||
402 | public function setSeriesDate($seriesDate) |
||
403 | { |
||
404 | $this->seriesDate = $seriesDate; |
||
405 | } |
||
406 | |||
407 | /** |
||
408 | * @return boolean |
||
409 | */ |
||
410 | public function isEnableSale() |
||
414 | |||
415 | /** |
||
416 | * @param boolean $enableSale |
||
417 | */ |
||
418 | public function setEnableSale($enableSale) |
||
422 | } |
||
423 |