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" : "gray"}) |
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( |
93
|
|
|
* targetEntity="AppBundle\Entity\PerformanceEvent", |
94
|
|
|
* inversedBy="priceCategories", |
95
|
|
|
* cascade={"persist"} |
96
|
|
|
* ) |
97
|
|
|
*/ |
98
|
|
|
protected $performanceEvent; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @var VenueSector |
102
|
|
|
* |
103
|
|
|
* @Serializer\SerializedName("venueSector_id") |
104
|
|
|
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\VenueSector") |
105
|
|
|
* @Type("AppBundle\Entity\VenueSector") |
106
|
|
|
* @Expose() |
107
|
|
|
*/ |
108
|
|
|
protected $venueSector; |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return integer |
112
|
|
|
*/ |
113
|
|
|
public function getId() |
114
|
|
|
{ |
115
|
|
|
return $this->id; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return PriceCategory |
120
|
|
|
*/ |
121
|
|
|
public function unsetTranslations() |
122
|
|
|
{ |
123
|
|
|
$this->translations = null; |
124
|
|
|
|
125
|
|
|
return $this; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param string $color |
130
|
|
|
* @return PriceCategory |
131
|
|
|
*/ |
132
|
|
|
public function setColor($color = 'grey') |
133
|
|
|
{ |
134
|
|
|
$this->color = $color; |
135
|
|
|
|
136
|
|
|
return $this; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @return string |
141
|
|
|
*/ |
142
|
|
|
public function getColor() |
143
|
|
|
{ |
144
|
|
|
return $this->color; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return VenueSector |
149
|
|
|
*/ |
150
|
|
|
public function getVenueSector() |
151
|
|
|
{ |
152
|
|
|
return $this->venueSector; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @param VenueSector $venueSector |
157
|
|
|
*/ |
158
|
|
|
public function setVenueSector(VenueSector $venueSector) |
159
|
|
|
{ |
160
|
|
|
$this->venueSector = $venueSector; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return string |
165
|
|
|
*/ |
166
|
|
|
public function getRows() |
167
|
|
|
{ |
168
|
|
|
return $this->rows; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @param string $rows |
173
|
|
|
*/ |
174
|
|
|
public function setRows(string $rows) |
175
|
|
|
{ |
176
|
|
|
$this->rows = $rows; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @return string |
181
|
|
|
*/ |
182
|
|
|
public function getPlaces() |
183
|
|
|
{ |
184
|
|
|
return $this->places; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @param string $places |
189
|
|
|
*/ |
190
|
|
|
public function setPlaces($places) |
191
|
|
|
{ |
192
|
|
|
$this->places = $places; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @return int |
197
|
|
|
*/ |
198
|
|
|
public function getPrice() |
199
|
|
|
{ |
200
|
|
|
return $this->price; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @param int $price |
205
|
|
|
*/ |
206
|
|
|
public function setPrice(int $price) |
207
|
|
|
{ |
208
|
|
|
$this->price = $price; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @return PerformanceEvent |
213
|
|
|
*/ |
214
|
|
|
public function getPerformanceEvent() |
215
|
|
|
{ |
216
|
|
|
return $this->performanceEvent; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @param PerformanceEvent $performanceEvent |
221
|
|
|
*/ |
222
|
|
|
public function setPerformanceEvent(PerformanceEvent $performanceEvent) |
223
|
|
|
{ |
224
|
|
|
$this->performanceEvent = $performanceEvent; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @return mixed |
229
|
|
|
*/ |
230
|
|
|
public function __toString() |
231
|
|
|
{ |
232
|
|
|
return 'PriceCategory'; |
233
|
|
|
} |
234
|
|
|
} |
235
|
|
|
|