1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Entity; |
4
|
|
|
|
5
|
|
|
use AppBundle\Traits\DeletedByTrait; |
6
|
|
|
use AppBundle\Traits\TimestampableTrait; |
7
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
8
|
|
|
use Doctrine\Common\Collections\Collection; |
9
|
|
|
use Doctrine\ORM\Mapping as ORM; |
10
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
11
|
|
|
use Gedmo\Translatable\Document\Translation; |
12
|
|
|
use JMS\Serializer\Annotation as Serializer; |
13
|
|
|
use JMS\Serializer\Annotation\ExclusionPolicy; |
14
|
|
|
use JMS\Serializer\Annotation\Expose; |
15
|
|
|
use JMS\Serializer\Annotation\Type; |
16
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface; |
17
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable; |
18
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @ORM\Table(name="venue") |
22
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\VenueRepository") |
23
|
|
|
* @Gedmo\TranslationEntity(class="AppBundle\Entity\Translations\VenueTranslation") |
24
|
|
|
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false) |
25
|
|
|
* @ExclusionPolicy("all") |
26
|
|
|
*/ |
27
|
|
|
class Venue extends AbstractPersonalTranslatable implements TranslatableInterface |
28
|
|
|
{ |
29
|
|
|
use TimestampableTrait, DeletedByTrait; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var integer |
33
|
|
|
* |
34
|
|
|
* @ORM\Column(name="id", type="integer") |
35
|
|
|
* @ORM\Id |
36
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
37
|
|
|
*/ |
38
|
|
|
protected $id; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var string |
42
|
|
|
* @Gedmo\Translatable |
43
|
|
|
* @Assert\NotBlank() |
44
|
|
|
* @ORM\Column(type="string", length=255) |
45
|
|
|
* |
46
|
|
|
* @Serializer\Groups({"get_ticket"}) |
47
|
|
|
* @Type("string") |
48
|
|
|
* @Expose() |
49
|
|
|
*/ |
50
|
|
|
protected $title; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var string |
54
|
|
|
* @Gedmo\Translatable |
55
|
|
|
* @Assert\NotBlank() |
56
|
|
|
* @Serializer\Groups({"get_ticket"}) |
57
|
|
|
* @ORM\Column(type="string", length=255) |
58
|
|
|
* @Type("string") |
59
|
|
|
* @Expose() |
60
|
|
|
*/ |
61
|
|
|
protected $address; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @var string |
65
|
|
|
* @Assert\NotBlank() |
66
|
|
|
* @ORM\Column(type="text", nullable=true) |
67
|
|
|
* @Type("string") |
68
|
|
|
* @Expose() |
69
|
|
|
*/ |
70
|
|
|
protected $hallTemplate; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var ArrayCollection|Translation[] |
74
|
|
|
* |
75
|
|
|
* @ORM\OneToMany( |
76
|
|
|
* targetEntity="AppBundle\Entity\Translations\VenueTranslation", |
77
|
|
|
* mappedBy="object", |
78
|
|
|
* cascade={"persist", "remove"} |
79
|
|
|
* ) |
80
|
|
|
*/ |
81
|
|
|
protected $translations; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @var ArrayCollection|PerformanceEvent[] |
85
|
|
|
* |
86
|
|
|
* @ORM\OneToMany( |
87
|
|
|
* targetEntity="AppBundle\Entity\PerformanceEvent", |
88
|
|
|
* mappedBy="venue", |
89
|
|
|
* cascade={"persist"}, |
90
|
|
|
* orphanRemoval=true |
91
|
|
|
* ) |
92
|
|
|
*/ |
93
|
|
|
protected $performanceEvents; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @var Collection|VenueSector[] |
97
|
|
|
* |
98
|
|
|
* @ORM\OneToMany( |
99
|
|
|
* targetEntity="AppBundle\Entity\VenueSector", |
100
|
|
|
* mappedBy="venue", |
101
|
|
|
* cascade={"persist", "remove"} |
102
|
|
|
* ) |
103
|
|
|
*/ |
104
|
|
|
protected $venueSectors; |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Venue constructor. |
108
|
|
|
*/ |
109
|
|
|
public function __construct() |
110
|
|
|
{ |
111
|
|
|
parent::__construct(); |
112
|
|
|
$this->performanceEvents = new ArrayCollection(); |
113
|
|
|
$this->venueSectors = new ArrayCollection(); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @return integer |
118
|
|
|
*/ |
119
|
|
|
public function getId() |
120
|
|
|
{ |
121
|
|
|
return $this->id; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return Venue |
126
|
|
|
*/ |
127
|
|
|
public function unsetTranslations() |
128
|
|
|
{ |
129
|
|
|
$this->translations = null; |
130
|
|
|
|
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return string |
136
|
|
|
*/ |
137
|
|
|
public function getTitle() |
138
|
|
|
{ |
139
|
|
|
return $this->title; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @param string $title |
144
|
|
|
* @return Venue |
145
|
|
|
*/ |
146
|
|
|
public function setTitle($title) |
147
|
|
|
{ |
148
|
|
|
$this->title = $title; |
149
|
|
|
|
150
|
|
|
return $this; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @return string |
155
|
|
|
*/ |
156
|
|
|
public function getAddress() |
157
|
|
|
{ |
158
|
|
|
return $this->address; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @param string $address |
163
|
|
|
* @return Venue |
164
|
|
|
*/ |
165
|
|
|
public function setAddress($address) |
166
|
|
|
{ |
167
|
|
|
$this->address = $address; |
168
|
|
|
|
169
|
|
|
return $this; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @return string |
174
|
|
|
*/ |
175
|
|
|
public function getHallTemplate() |
176
|
|
|
{ |
177
|
|
|
return $this->hallTemplate; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @param string $hallTemplate |
182
|
|
|
* @return Venue |
183
|
|
|
*/ |
184
|
|
|
public function setHallTemplate($hallTemplate) |
185
|
|
|
{ |
186
|
|
|
$this->hallTemplate = $hallTemplate; |
187
|
|
|
|
188
|
|
|
return $this; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* @param PerformanceEvent $performanceEvent |
193
|
|
|
* @return Venue |
194
|
|
|
*/ |
195
|
|
|
public function addPerformanceEvent(PerformanceEvent $performanceEvent) |
196
|
|
|
{ |
197
|
|
|
$this->performanceEvents[] = $performanceEvent; |
198
|
|
|
|
199
|
|
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @param PerformanceEvent $performanceEvent |
204
|
|
|
*/ |
205
|
|
|
public function removePerformanceEvent(PerformanceEvent $performanceEvent) |
206
|
|
|
{ |
207
|
|
|
$this->performanceEvents->removeElement($performanceEvent); |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @return Collection |
212
|
|
|
*/ |
213
|
|
|
public function getPerformanceEvents() |
214
|
|
|
{ |
215
|
|
|
return $this->performanceEvents; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @param VenueSector $venueSector |
220
|
|
|
* @return Venue |
221
|
|
|
*/ |
222
|
|
|
public function addVenueSector(VenueSector $venueSector) |
223
|
|
|
{ |
224
|
|
|
$this->venueSectors[] = $venueSector; |
225
|
|
|
|
226
|
|
|
return $this; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @param VenueSector $venueSector |
231
|
|
|
*/ |
232
|
|
|
public function removeVenueSector(VenueSector $venueSector) |
233
|
|
|
{ |
234
|
|
|
$this->venueSectors->removeElement($venueSector); |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @return Collection |
239
|
|
|
*/ |
240
|
|
|
public function getVenueSector() |
241
|
|
|
{ |
242
|
|
|
return $this->venueSectors; |
|
|
|
|
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @return string |
247
|
|
|
*/ |
248
|
|
|
public function __toString() |
249
|
|
|
{ |
250
|
|
|
return $this->getTitle(); |
251
|
|
|
} |
252
|
|
|
} |
253
|
|
|
|