Completed
Push — master ( 5bb9e4...33b9a4 )
by Serhii
09:16 queued 09:08
created

Seat::unsetTranslations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
ccs 0
cts 0
cp 0
crap 2
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\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 Symfony\Component\Validator\Constraints as Assert;
14
use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface;
15
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable;
16
17
/**
18
 * @ORM\Table(name="seat")
19
 * @ORM\Entity(repositoryClass="AppBundle\Repository\SeatRepository")
20
 * @Gedmo\TranslationEntity(class="AppBundle\Entity\Translations\SeatTranslation")
21
 * @ExclusionPolicy("all")
22
 */
23
class Seat 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 integer
36
     * @Assert\NotBlank()
37
     *
38
     * @ORM\Column(name="row", type="integer")
39
     *
40
     * @Serializer\Groups({"get_ticket"})
41
     * @Type("integer")
42
     * @Expose()
43
     */
44
    protected $row;
45
46
    /**
47
     * @var integer
48
     * @Assert\NotBlank()
49
     *
50
     * @Serializer\Groups({"get_ticket"})
51
     * @ORM\Column(name="place", type="integer")
52
     * @Type("integer")
53
     * @Expose()
54
     */
55
    protected $place;
56
57
    /**
58
     * @var VenueSector
59
     *
60
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\VenueSector", inversedBy="seats")
61
     * @Type("AppBundle\Entity\VenueSector")
62
     * @Expose()
63
     */
64
    protected $venueSector;
65
66
    /**
67
     * @return integer
68
     */
69
    public function getId()
70
    {
71
        return $this->id;
72
    }
73
74
75
    /**
76
     * @var ArrayCollection|Translation[]
77
     *
78
     * @ORM\OneToMany(
79
     *     targetEntity="AppBundle\Entity\Translations\SeatTranslation",
80
     *     mappedBy="object",
81
     *     cascade={"persist", "remove"}
82
     * )
83
     */
84
    protected $translations;
85
86
    /**
87
     * @return Seat
88
     */
89
    public function unsetTranslations()
90
    {
91
        $this->translations = null;
92
93
        return $this;
94
    }
95
96
    /**
97
     * @return int
98
     */
99
    public function getRow(): int
100
    {
101
        return $this->row;
102
    }
103
104
    /**
105
     * @param int $row
106
     */
107
    public function setRow(int $row)
108
    {
109
        $this->row = $row;
110
    }
111
112
    /**
113
     * @return int
114
     */
115
    public function getPlace(): int
116
    {
117
        return $this->place;
118
    }
119
120
    /**
121
     * @param int $place
122
     */
123
    public function setPlace(int $place)
124
    {
125
        $this->place = $place;
126
    }
127
128
    /**
129
     * @return VenueSector
130
     */
131
    public function getVenueSector(): VenueSector
132
    {
133
        return $this->venueSector;
134
    }
135
136
    /**
137
     * Get VenueSector Id.
138
     *
139
     * @Serializer\VirtualProperty()
140
     * @Serializer\SerializedName("venue_sector_id")
141
     * @Type("integer")
142
     * @Serializer\Groups({"get_ticket"})
143
     *
144
     * @return integer
145
     */
146
    public function getVenueSectorId(): int
147
    {
148
        return $this->venueSector->getId();
149
    }
150
151
    /**
152
     * @return string
153
     */
154
    public function __toString()
155
    {
156 2
        return (string) $this->getId();
157
    }
158
}
159