|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AppBundle\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\Collection; |
|
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
7
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
8
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
|
9
|
|
|
use Gedmo\Blameable\Traits\BlameableEntity; |
|
10
|
|
|
use JMS\Serializer\Annotation as Serializer; |
|
11
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
12
|
|
|
use AppBundle\Traits\TimestampableTrait; |
|
13
|
|
|
use AppBundle\Traits\DeletedByTrait; |
|
14
|
|
|
use JMS\Serializer\Annotation\ExclusionPolicy; |
|
15
|
|
|
use JMS\Serializer\Annotation\Expose; |
|
16
|
|
|
use JMS\Serializer\Annotation\Type; |
|
17
|
|
|
use JMS\Serializer\Annotation\Accessor; |
|
18
|
|
|
use AppBundle\Validator\TwoPerformanceEventsPerDay; |
|
19
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface; |
|
20
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @ORM\Table(name="performance_schedule") |
|
24
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\PerformanceEventRepository") |
|
25
|
|
|
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false) |
|
26
|
|
|
* @ExclusionPolicy("all") |
|
27
|
|
|
* @Gedmo\TranslationEntity(class="AppBundle\Entity\Translations\PerformanceEventTranslation") |
|
28
|
|
|
* @TwoPerformanceEventsPerDay() |
|
29
|
|
|
*/ |
|
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 ArrayCollection|Translation[] |
|
120
|
|
|
* |
|
121
|
|
|
* @ORM\OneToMany( |
|
122
|
|
|
* targetEntity="AppBundle\Entity\Translations\PerformanceEventTranslation", |
|
123
|
|
|
* mappedBy="object", |
|
124
|
|
|
* cascade={"persist", "remove"} |
|
125
|
|
|
* ) |
|
126
|
|
|
*/ |
|
127
|
|
|
protected $translations; |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
4 |
|
* @var PriceCategory[] |
|
131
|
|
|
* |
|
132
|
4 |
|
* @Assert\Valid |
|
133
|
|
|
* @ORM\OneToMany( |
|
134
|
4 |
|
* targetEntity="AppBundle\Entity\PriceCategory", |
|
135
|
|
|
* mappedBy="performanceEvent", |
|
136
|
|
|
* cascade={"all"}, |
|
137
|
|
|
* orphanRemoval=true |
|
138
|
|
|
* ) |
|
139
|
|
|
*/ |
|
140
|
|
|
protected $priceCategories; |
|
141
|
|
|
|
|
142
|
10 |
|
public function __construct() |
|
143
|
|
|
{ |
|
144
|
10 |
|
parent::__construct(); |
|
145
|
|
|
$this->priceCategories = new ArrayCollection(); |
|
|
|
|
|
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* Unset translations |
|
150
|
|
|
* |
|
151
|
|
|
* @return PerformanceEvent |
|
152
|
|
|
*/ |
|
153
|
7 |
|
public function unsetTranslations() |
|
154
|
|
|
{ |
|
155
|
7 |
|
$this->translations = null; |
|
156
|
|
|
|
|
157
|
7 |
|
return $this; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* Get id |
|
162
|
|
|
* |
|
163
|
|
|
* @return integer |
|
164
|
|
|
*/ |
|
165
|
14 |
|
public function getId() |
|
166
|
|
|
{ |
|
167
|
14 |
|
return $this->id; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* Set dateTime |
|
172
|
|
|
* |
|
173
|
|
|
* @param \DateTime $dateTime |
|
174
|
|
|
* @return PerformanceEvent |
|
175
|
|
|
*/ |
|
176
|
|
|
public function setDateTime($dateTime) |
|
177
|
|
|
{ |
|
178
|
|
|
$this->dateTime = $dateTime; |
|
179
|
|
|
|
|
180
|
|
|
return $this; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* Get dateTime |
|
185
|
|
|
* |
|
186
|
|
|
* @return \DateTime |
|
187
|
|
|
*/ |
|
188
|
6 |
|
public function getDateTime() |
|
189
|
|
|
{ |
|
190
|
6 |
|
return $this->dateTime; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
2 |
|
/** |
|
194
|
|
|
* Set performance |
|
195
|
2 |
|
* |
|
196
|
1 |
|
* @param \AppBundle\Entity\Performance $performance |
|
197
|
|
|
* @return PerformanceEvent |
|
198
|
|
|
*/ |
|
199
|
1 |
|
public function setPerformance(\AppBundle\Entity\Performance $performance = null) |
|
200
|
|
|
{ |
|
201
|
|
|
$this->performance = $performance; |
|
202
|
|
|
|
|
203
|
|
|
return $this; |
|
204
|
|
|
} |
|
205
|
4 |
|
|
|
206
|
|
|
/** |
|
207
|
4 |
|
* Get performance |
|
208
|
|
|
* |
|
209
|
|
|
* @return \AppBundle\Entity\Performance |
|
210
|
|
|
*/ |
|
211
|
|
|
public function getPerformance() |
|
212
|
|
|
{ |
|
213
|
|
|
return $this->performance; |
|
214
|
|
|
} |
|
215
|
|
|
|
|
216
|
|
|
public function __toString() |
|
217
|
|
|
{ |
|
218
|
|
|
if ($this->getDateTime()) { |
|
219
|
|
|
return $this->getDateTime()->format('d-m-Y H:i'); |
|
220
|
|
|
} |
|
221
|
4 |
|
|
|
222
|
|
|
return date("F j, Y, g:i a"); |
|
223
|
4 |
|
} |
|
224
|
|
|
|
|
225
|
|
|
/** |
|
226
|
|
|
* @return mixed |
|
227
|
|
|
*/ |
|
228
|
|
|
public function getYear() |
|
229
|
|
|
{ |
|
230
|
|
|
return $this->getDateTime()->format('Y'); |
|
231
|
|
|
} |
|
232
|
|
|
|
|
233
|
|
|
/** |
|
234
|
|
|
* @param mixed $year |
|
235
|
|
|
*/ |
|
236
|
|
|
public function setYear($year) |
|
237
|
4 |
|
{ |
|
238
|
|
|
$this->year = $year; |
|
239
|
4 |
|
} |
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* @return int |
|
243
|
|
|
*/ |
|
244
|
|
|
public function getMonth() |
|
245
|
|
|
{ |
|
246
|
|
|
return $this->getDateTime()->format('n'); |
|
247
|
|
|
} |
|
248
|
|
|
|
|
249
|
|
|
/** |
|
250
|
|
|
* @param int $month |
|
251
|
|
|
*/ |
|
252
|
|
|
public function setMonth($month) |
|
253
|
4 |
|
{ |
|
254
|
|
|
$this->month = $month; |
|
255
|
4 |
|
} |
|
256
|
|
|
|
|
257
|
|
|
/** |
|
258
|
|
|
* @return int |
|
259
|
|
|
*/ |
|
260
|
|
|
public function getDay() |
|
261
|
|
|
{ |
|
262
|
|
|
return $this->getDateTime()->format('j'); |
|
263
|
|
|
} |
|
264
|
|
|
|
|
265
|
|
|
/** |
|
266
|
|
|
* @param int $day |
|
267
|
|
|
*/ |
|
268
|
|
|
public function setDay($day) |
|
269
|
7 |
|
{ |
|
270
|
|
|
$this->day = $day; |
|
271
|
7 |
|
} |
|
272
|
|
|
|
|
273
|
|
|
/** |
|
274
|
|
|
* @return string |
|
275
|
|
|
*/ |
|
276
|
|
|
public function getTime() |
|
277
|
4 |
|
{ |
|
278
|
|
|
return $this->getDateTime()->format('G:i'); |
|
279
|
4 |
|
} |
|
280
|
4 |
|
|
|
281
|
|
|
/** |
|
282
|
|
|
* @param string $time |
|
283
|
|
|
*/ |
|
284
|
|
|
public function setTime($time) |
|
285
|
|
|
{ |
|
286
|
|
|
$this->time = $time; |
|
287
|
|
|
} |
|
288
|
|
|
|
|
289
|
|
|
/** |
|
290
|
|
|
* @return Venue |
|
291
|
|
|
*/ |
|
292
|
|
|
public function getVenue() |
|
293
|
|
|
{ |
|
294
|
|
|
return $this->venue; |
|
295
|
|
|
} |
|
296
|
|
|
|
|
297
|
|
|
/** |
|
298
|
|
|
* @param Venue $venue |
|
299
|
|
|
* @return PerformanceEvent |
|
300
|
|
|
*/ |
|
301
|
|
|
public function setVenue(Venue $venue) |
|
302
|
|
|
{ |
|
303
|
|
|
$this->venue = $venue; |
|
304
|
|
|
|
|
305
|
|
|
return $this; |
|
306
|
|
|
} |
|
307
|
|
|
|
|
308
|
|
|
/** |
|
309
|
|
|
* @param PriceCategory $priceCategory |
|
310
|
|
|
* @return PerformanceEvent |
|
311
|
|
|
*/ |
|
312
|
|
|
public function addPriceCategory(PriceCategory $priceCategory) |
|
313
|
|
|
{ |
|
314
|
|
|
$this->priceCategories[] = $priceCategory; |
|
315
|
|
|
|
|
316
|
|
|
return $this; |
|
317
|
|
|
} |
|
318
|
|
|
|
|
319
|
|
|
/** |
|
320
|
|
|
* @param PriceCategory $priceCategory |
|
321
|
|
|
*/ |
|
322
|
|
|
public function removePriceCategories(PriceCategory $priceCategory) |
|
323
|
|
|
{ |
|
324
|
|
|
$this->priceCategories->removeElement($priceCategory); |
|
|
|
|
|
|
325
|
|
|
} |
|
326
|
|
|
|
|
327
|
|
|
/** |
|
328
|
|
|
* @return Collection |
|
329
|
|
|
*/ |
|
330
|
|
|
public function getPriceCategories() |
|
331
|
|
|
{ |
|
332
|
|
|
return $this->priceCategories; |
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
/** |
|
336
|
|
|
* @param PriceCategory[]|ArrayCollection $priceCategory |
|
337
|
|
|
*/ |
|
338
|
|
|
public function setPriceCategories($priceCategory) |
|
339
|
|
|
{ |
|
340
|
|
|
$this->priceCategories = $priceCategory; |
|
|
|
|
|
|
341
|
|
|
} |
|
342
|
|
|
} |
|
343
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..