Completed
Push — master ( c37a1b...043479 )
by Serhii
11s
created

PriceCategory::getVenue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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\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
     * @Gedmo\Translatable
37
     * @Assert\NotBlank()
38
     * @ORM\Column(type="string", length=255)
39
     * @Type("string")
40
     * @Expose()
41
     */
42
    protected $title;
43
44
    /**
45
     * @var string
46
     * @Assert\NotBlank()
47
     * @ORM\Column(type="string", length=255)
48
     * @Type("string")
49
     * @Expose()
50
     */
51
    protected $color;
52
53
    /**
54
     * @var ArrayCollection|Translation[]
55
     *
56
     * @ORM\OneToMany(
57
     *     targetEntity="AppBundle\Entity\Translations\PriceCategoryTranslation",
58
     *     mappedBy="object",
59
     *     cascade={"persist", "remove"}
60
     * )
61
     */
62
    protected $translations;
63
64
    /**
65
     * @var Venue
66
     *
67
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Venue", inversedBy="priceCategories")
68
     * @Type("AppBundle\Entity\Venue")
69
     * @Expose()
70
     */
71
    protected $venue;
72
73
    /**
74
     * @var Collection|Seat[]
75
     *
76
     * @ORM\OneToMany(
77
     *     targetEntity="AppBundle\Entity\Seat",
78
     *     mappedBy="priceCategory",
79
     *     cascade={"persist"}
80
     * )
81
     */
82
    protected $seats;
83
84
85
    /**
86
     * PriceCategory constructor.
87
     */
88
    public function __construct()
89
    {
90
        parent::__construct();
91
        $this->seats = new ArrayCollection();
92
    }
93
94
    /**
95
     * @return integer
96
     */
97
    public function getId()
98
    {
99
        return $this->id;
100
    }
101
102
    /**
103
     * @return PriceCategory
104
     */
105
    public function unsetTranslations()
106
    {
107
        $this->translations = null;
108
109
        return $this;
110
    }
111
112
    /**
113
     * @return string
114
     */
115
    public function getTitle()
116
    {
117
        return $this->title;
118
    }
119
120
    /**
121
     * @param  string $color
122
     * @return PriceCategory
123
     */
124
    public function setColor($color)
125
    {
126
        $this->color = $color;
127
128
        return $this;
129
    }
130
131
    /**
132
     * @return string
133
     */
134
    public function getColor()
135
    {
136
        return $this->color;
137
    }
138
139
    /**
140
     * @param  string $title
141
     * @return PriceCategory
142
     */
143
    public function setTitle($title)
144
    {
145
        $this->title = $title;
146
147
        return $this;
148
    }
149
150
    /**
151
     * @return Venue
152
     */
153
    public function getVenue()
154
    {
155
        return $this->venue;
156
    }
157
158
    /**
159
     * @param  Seat $seat
160
     * @return PriceCategory
161
     */
162
    public function addSeat(Seat $seat)
163
    {
164
        $this->seats[] = $seat;
165
166
        return $this;
167
    }
168
169
    /**
170
     * @param Seat $seat
171
     */
172
    public function removeSeat(Seat $seat)
173
    {
174
        $this->seats->removeElement($seat);
175
    }
176
177
    /**
178
     * @return Collection
179
     */
180
    public function getSeat()
181
    {
182
        return $this->seats;
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->seats; of type Doctrine\Common\Collecti...AppBundle\Entity\Seat[] adds the type AppBundle\Entity\Seat[] to the return on line 182 which is incompatible with the return type documented by AppBundle\Entity\PriceCategory::getSeat of type Doctrine\Common\Collections\Collection.
Loading history...
183
    }
184
185
    /**
186
     * @return string
187
     */
188
    public function __toString()
189
    {
190
        return $this->getTitle();
191
    }
192
193
    /**
194
     * @param Venue $venue
195
     */
196
    public function setVenue(Venue $venue)
197
    {
198
        $this->venue = $venue;
199
    }
200
}
201