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