Completed
Pull Request — master (#136)
by
unknown
12:23
created

VenueSector::addPriceCategory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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