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