Completed
Pull Request — master (#136)
by
unknown
19:52 queued 08:32
created

PriceCategory   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 210
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 91.89%

Importance

Changes 0
Metric Value
dl 0
loc 210
ccs 34
cts 37
cp 0.9189
rs 10
c 0
b 0
f 0
wmc 15
lcom 1
cbo 1

15 Methods

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