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\ExclusionPolicy; |
10
|
|
|
use JMS\Serializer\Annotation\Expose; |
11
|
|
|
use JMS\Serializer\Annotation\Type; |
12
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface; |
13
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable; |
14
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @ORM\Table(name="price_category") |
18
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\PriceCategoryRepository") |
19
|
|
|
* @Gedmo\TranslationEntity(class="AppBundle\Entity\Translations\PriceCategoryTranslation") |
20
|
|
|
* @ExclusionPolicy("all") |
21
|
|
|
*/ |
22
|
|
|
class PriceCategory extends AbstractPersonalTranslatable implements TranslatableInterface |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var integer |
26
|
|
|
* |
27
|
|
|
* @ORM\Column(name="id", type="integer") |
28
|
|
|
* @ORM\Id |
29
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
30
|
|
|
*/ |
31
|
|
|
protected $id; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
* @Assert\NotBlank() |
36
|
|
|
* @ORM\Column(type="string", length=255) |
37
|
|
|
* @Type("string") |
38
|
|
|
* @Expose() |
39
|
|
|
*/ |
40
|
|
|
protected $rows; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string |
44
|
|
|
* @Assert\NotBlank() |
45
|
|
|
* @ORM\Column(type="string", length=255) |
46
|
|
|
* @Type("string") |
47
|
|
|
* @Expose() |
48
|
|
|
*/ |
49
|
|
|
protected $places; |
50
|
|
|
/** |
51
|
|
|
* @var string |
52
|
|
|
* @Assert\NotBlank() |
53
|
|
|
* @ORM\Column(type="string", length=255) |
54
|
|
|
* @Type("string") |
55
|
|
|
* @Expose() |
56
|
|
|
*/ |
57
|
|
|
protected $color; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var integer |
61
|
|
|
* @Assert\NotBlank() |
62
|
|
|
* @ORM\Column(type="integer") |
63
|
|
|
* @Type("integer") |
64
|
|
|
* @Expose() |
65
|
|
|
*/ |
66
|
|
|
protected $price; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @var ArrayCollection|Translation[] |
70
|
|
|
* |
71
|
|
|
* @ORM\OneToMany( |
72
|
|
|
* targetEntity="AppBundle\Entity\Translations\PriceCategoryTranslation", |
73
|
|
|
* mappedBy="object", |
74
|
|
|
* cascade={"persist", "remove"} |
75
|
|
|
* ) |
76
|
|
|
*/ |
77
|
|
|
protected $translations; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var PerformanceEvent |
81
|
|
|
* |
82
|
|
|
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\PerformanceEvent", inversedBy="priceCategories") |
83
|
|
|
* @Type("AppBundle\Entity\PerformanceEvent") |
84
|
|
|
* @Expose() |
85
|
|
|
*/ |
86
|
|
|
protected $performanceEvent; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @var VenueSector |
90
|
|
|
* |
91
|
|
|
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\VenueSector", inversedBy="priceCategories") |
92
|
|
|
* @Type("AppBundle\Entity\VenueSector") |
93
|
|
|
* @Expose() |
94
|
|
|
*/ |
95
|
|
|
protected $venueSector; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @return integer |
99
|
|
|
*/ |
100
|
|
|
public function getId() |
101
|
|
|
{ |
102
|
|
|
return $this->id; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return PriceCategory |
107
|
|
|
*/ |
108
|
|
|
public function unsetTranslations() |
109
|
|
|
{ |
110
|
|
|
$this->translations = null; |
111
|
|
|
|
112
|
|
|
return $this; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return string |
117
|
|
|
*/ |
118
|
|
|
public function getTitle() |
119
|
|
|
{ |
120
|
|
|
return $this->title; |
|
|
|
|
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @param string $color |
125
|
|
|
* @return PriceCategory |
126
|
|
|
*/ |
127
|
|
|
public function setColor($color) |
128
|
|
|
{ |
129
|
|
|
$this->color = $color; |
130
|
|
|
|
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return string |
136
|
|
|
*/ |
137
|
|
|
public function getColor() |
138
|
|
|
{ |
139
|
|
|
return $this->color; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @param string $title |
144
|
|
|
* @return PriceCategory |
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 __toString() |
157
|
|
|
{ |
158
|
|
|
return $this->getTitle(); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @return VenueSector |
163
|
|
|
*/ |
164
|
|
|
public function getVenueSector(): VenueSector |
165
|
|
|
{ |
166
|
|
|
return $this->venueSector; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @param VenueSector $venueSector |
171
|
|
|
*/ |
172
|
|
|
public function setVenueSector(VenueSector $venueSector) |
173
|
|
|
{ |
174
|
|
|
$this->venueSector = $venueSector; |
175
|
|
|
} |
176
|
|
|
} |
177
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: