Completed
Pull Request — master (#148)
by
unknown
02:58
created

VenueSector::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
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="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
     * @Type("integer")
32
     * @Expose()
33
     */
34
    protected $id;
35
36
    /**
37
     * @var string
38
     * @Gedmo\Translatable
39
     * @Assert\NotBlank()
40
     * @ORM\Column(type="string", length=255)
41
     * @Type("string")
42
     * @Expose()
43
     */
44
    protected $title;
45
46
    /**
47
     * @var ArrayCollection|Translation[]
48
     *
49
     * @ORM\OneToMany(
50
     *     targetEntity="AppBundle\Entity\Translations\VenueSectorTranslation",
51
     *     mappedBy="object",
52
     *     cascade={"persist", "remove"}
53
     * )
54
     */
55
    protected $translations;
56
57
    /**
58
     * @var Venue
59
     *
60
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Venue", inversedBy="venueSectors")
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
     * @ORM\Column(name="slug", type="string", length=255)
77
     * @Type("string")
78
     * @Expose
79
     */
80
    private $slug;
81
82
    /**
83
     * VenueSector constructor.
84
     */
85
    public function __construct()
86
    {
87
        parent::__construct();
88
        $this->seats = new ArrayCollection();
89
    }
90
91
    /**
92
     * @return integer
93
     */
94 3
    public function getId()
95
    {
96 3
        return $this->id;
97
    }
98
99
    /**
100
     * @return VenueSector
101
     */
102 1
    public function unsetTranslations()
103
    {
104 1
        $this->translations = null;
105
106 1
        return $this;
107
    }
108
109
    /**
110
     * @return string
111
     */
112 2
    public function getTitle()
113
    {
114 2
        return $this->title;
115
    }
116
117
    /**
118
     * @param  string $title
119
     * @return VenueSector
120
     */
121
    public function setTitle($title)
122
    {
123
        $this->title = $title;
124
125
        return $this;
126
    }
127
128
    /**
129
     * @return Venue
130
     */
131
    public function getVenue()
132
    {
133
        return $this->venue;
134
    }
135
136
    /**
137
     * @param  Seat $seat
138
     * @return VenueSector
139
     */
140
    public function addSeat(Seat $seat)
141
    {
142
        $this->seats[] = $seat;
143
144
        return $this;
145
    }
146
147
    /**
148
     * @param Seat $seat
149
     */
150
    public function removeSeat(Seat $seat)
151
    {
152
        $this->seats->removeElement($seat);
153
    }
154
155
    /**
156
     * @return Collection
157
     */
158
    public function getSeat()
159
    {
160
        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 160 which is incompatible with the return type documented by AppBundle\Entity\VenueSector::getSeat of type Doctrine\Common\Collections\Collection.
Loading history...
161
    }
162
163
    /**
164
     * Get slug
165
     *
166
     * @return string
167
     */
168
    public function getSlug()
169
    {
170
        return $this->slug;
171
    }
172
173
    /**
174
     * Set slug
175
     *
176
     * @param  string      $slug
177
     * @return VenueSector
178
     */
179
    public function setSlug($slug)
180
    {
181
        $this->slug = $slug;
182
183
        return $this;
184
    }
185
186
    /**
187
     * @return string
188
     */
189 2
    public function __toString()
190
    {
191 2
        return $this->getTitle();
192
    }
193
}
194