6
6
7
7
use Doctrine \Common \Collections \ArrayCollection ;
8
8
use Doctrine \Common \Collections \Collection ;
9
+ use Doctrine \DBAL \Types \Types ;
9
10
use Doctrine \ORM \Mapping as ORM ;
10
11
use JMS \Serializer \Annotation as Serializer ;
11
12
use Manuxi \SuluEventBundle \Entity \Interfaces \AuditableTranslatableInterface ;
16
17
use Manuxi \SuluEventBundle \Entity \Traits \RouteTranslatableTrait ;
17
18
use Manuxi \SuluEventBundle \Entity \Traits \ShowAuthorTranslatableTrait ;
18
19
use Manuxi \SuluEventBundle \Entity \Traits \ShowDateTranslatableTrait ;
20
+ use Manuxi \SuluEventBundle \Repository \EventRepository ;
19
21
20
- /**
21
- * @ORM\Entity
22
- * @ORM\Table(name="app_event")
23
- * @ORM\Entity(repositoryClass="Manuxi\SuluEventBundle\Repository\EventRepository")
24
- */
22
+ #[ORM \Entity(repositoryClass: EventRepository::class)]
23
+ #[ORM \Table(name: 'app_event ' )]
25
24
class Event implements AuditableTranslatableInterface
26
25
{
27
26
public const RESOURCE_KEY = 'events ' ;
@@ -36,68 +35,44 @@ class Event implements AuditableTranslatableInterface
36
35
use ImageTranslatableTrait;
37
36
use ShowAuthorTranslatableTrait;
38
37
use ShowDateTranslatableTrait;
39
- /**
40
- * @ORM\Id()
41
- * @ORM\GeneratedValue()
42
- * @ORM\Column(type="integer")
43
- */
38
+
39
+ #[ORM \Id]
40
+ #[ORM \GeneratedValue]
41
+ #[ORM \Column(type: Types::INTEGER )]
44
42
private ?int $ id = null ;
45
43
46
- /**
47
- * @ORM\OneToOne(targetEntity="Manuxi\SuluEventBundle\Entity\EventSeo", mappedBy="event", cascade={"persist", "remove"})
48
- *
49
- * @Serializer\Exclude
50
- */
44
+ #[Serializer \Exclude]
45
+ #[ORM \OneToOne(mappedBy: 'event ' , targetEntity: EventSeo::class, cascade: ['persist ' , 'remove ' ])]
51
46
private ?EventSeo $ eventSeo = null ;
52
47
53
- /**
54
- * @ORM\OneToOne(targetEntity="Manuxi\SuluEventBundle\Entity\EventExcerpt", mappedBy="event", cascade={"persist", "remove"})
55
- *
56
- * @Serializer\Exclude
57
- */
48
+ #[Serializer \Exclude]
49
+ #[ORM \OneToOne(mappedBy: 'event ' , targetEntity: EventExcerpt::class, cascade: ['persist ' , 'remove ' ])]
58
50
private ?EventExcerpt $ eventExcerpt = null ;
59
51
60
- /**
61
- * @ORM\Column(type="boolean", nullable=false)
62
- */
52
+ #[ORM \Column(type: Types::BOOLEAN , nullable: false )]
63
53
private bool $ enabled ;
64
54
65
- /**
66
- * @ORM\Column(type="datetime_immutable", nullable=true)
67
- */
55
+ #[ORM \Column(type: Types::DATETIME_IMMUTABLE , nullable: true )]
68
56
private ?\DateTimeImmutable $ startDate = null ;
69
57
70
- /**
71
- * @ORM\Column(type="datetime_immutable", nullable=true)
72
- */
58
+ #[ORM \Column(type: Types::DATETIME_IMMUTABLE , nullable: true )]
73
59
private ?\DateTimeImmutable $ endDate = null ;
74
60
75
- /**
76
- * @ORM\Column(type="string", length=255, nullable=true)
77
- */
61
+ #[ORM \Column(type: Types::STRING , length: 255 , nullable: true )]
78
62
private ?string $ email = null ;
79
63
80
- /**
81
- * @ORM\Column(type="string", nullable=true)
82
- */
64
+ #[ORM \Column(type: Types::STRING , length: 255 , nullable: true )]
83
65
private ?string $ phoneNumber = null ;
84
66
85
- /**
86
- * @ORM\Column(type="json", nullable=true)
87
- */
67
+ #[ORM \Column(type: Types::JSON , nullable: true )]
88
68
private ?array $ images = null ;
89
69
90
- /**
91
- * @ORM\ManyToOne(targetEntity="Manuxi\SuluEventBundle\Entity\Location")
92
- * @ORM\JoinColumn(onDelete="SET NULL")
93
- */
70
+ #[ORM \ManyToOne(targetEntity: Location::class)]
71
+ #[ORM \JoinColumn(onDelete: 'SET NULL ' )]
94
72
private ?Location $ location = null ;
95
73
96
- /**
97
- * @var Collection<string, EventTranslation>
98
- * @ORM\OneToMany(targetEntity="Manuxi\SuluEventBundle\Entity\EventTranslation", mappedBy="event", cascade={"ALL"}, indexBy="locale", fetch="EXTRA_LAZY")
99
- * @Serializer\Exclude
100
- */
74
+ #[Serializer \Exclude]
75
+ #[ORM \OneToMany(mappedBy: 'event ' , targetEntity: EventTranslation::class, cascade: ['all ' ], fetch: 'EXTRA_LAZY ' , indexBy: 'locale ' )]
101
76
private Collection $ translations ;
102
77
103
78
private string $ locale = 'de ' ;
@@ -172,9 +147,7 @@ public function setLocation(?Location $location): self
172
147
return $ this ;
173
148
}
174
149
175
- /**
176
- * @Serializer\VirtualProperty
177
- */
150
+ #[Serializer \VirtualProperty]
178
151
public function getLocationId (): ?int
179
152
{
180
153
if (!$ this ->location ) {
@@ -184,9 +157,7 @@ public function getLocationId(): ?int
184
157
return $ this ->location ->getId ();
185
158
}
186
159
187
- /**
188
- * @Serializer\VirtualProperty(name="title")
189
- */
160
+ #[Serializer \VirtualProperty(name: "title " )]
190
161
public function getTitle (): ?string
191
162
{
192
163
$ translation = $ this ->getTranslation ($ this ->locale );
@@ -208,9 +179,7 @@ public function setTitle(string $title): self
208
179
return $ this ;
209
180
}
210
181
211
- /**
212
- * @Serializer\VirtualProperty(name="subtitle")
213
- */
182
+ #[Serializer \VirtualProperty(name: "subtitle " )]
214
183
public function getSubtitle (): ?string
215
184
{
216
185
$ translation = $ this ->getTranslation ($ this ->locale );
@@ -232,9 +201,7 @@ public function setSubtitle(?string $subtitle): self
232
201
return $ this ;
233
202
}
234
203
235
- /**
236
- * @Serializer\VirtualProperty(name="summary")
237
- */
204
+ #[Serializer \VirtualProperty(name: "summary " )]
238
205
public function getSummary (): ?string
239
206
{
240
207
$ translation = $ this ->getTranslation ($ this ->locale );
@@ -256,9 +223,7 @@ public function setSummary(?string $summary): self
256
223
return $ this ;
257
224
}
258
225
259
- /**
260
- * @Serializer\VirtualProperty(name="text")
261
- */
226
+ #[Serializer \VirtualProperty(name: "text " )]
262
227
public function getText (): ?string
263
228
{
264
229
$ translation = $ this ->getTranslation ($ this ->locale );
@@ -280,9 +245,7 @@ public function setText(string $text): self
280
245
return $ this ;
281
246
}
282
247
283
- /**
284
- * @Serializer\VirtualProperty(name="footer")
285
- */
248
+ #[Serializer \VirtualProperty(name: "footer " )]
286
249
public function getFooter (): ?string
287
250
{
288
251
$ translation = $ this ->getTranslation ($ this ->locale );
@@ -336,9 +299,7 @@ public function setEventExcerpt(?EventExcerpt $eventExcerpt): self
336
299
return $ this ;
337
300
}
338
301
339
- /**
340
- * @Serializer\VirtualProperty(name="ext")
341
- */
302
+ #[Serializer \VirtualProperty(name: "ext " )]
342
303
public function getExt (): array
343
304
{
344
305
return $ this ->ext ;
@@ -407,9 +368,7 @@ private function initExt(): self
407
368
return $ this ;
408
369
}
409
370
410
- /**
411
- * @Serializer\VirtualProperty("availableLocales")
412
- */
371
+ #[Serializer \VirtualProperty(name: "availableLocales " )]
413
372
public function getAvailableLocales (): array
414
373
{
415
374
return \array_values ($ this ->translations ->getKeys ());
0 commit comments