Completed
Push — master ( 93c3a8...5bb9e4 )
by Serhii
27s queued 17s
created

RowsForSale::getVenueSector()   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 as Serializer;
11
use JMS\Serializer\Annotation\ExclusionPolicy;
12
use JMS\Serializer\Annotation\Expose;
13
use JMS\Serializer\Annotation\Type;
14
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
15
use Symfony\Component\Validator\Constraints as Assert;
16
use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface;
17
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable;
18
19
/**
20
 * @ORM\Table(name="rows_for_sale")
21
 * @UniqueEntity(fields={"row","venueSector"})
22
 * @ORM\Entity(repositoryClass="AppBundle\Repository\RowsForSaleRepository")
23
 * @Gedmo\TranslationEntity(class="AppBundle\Entity\Translations\RowsForSaleTranslation")
24
 * @ExclusionPolicy("all")
25
 */
26
class RowsForSale extends AbstractPersonalTranslatable implements TranslatableInterface
27
{
28
    /**
29
     * @var integer
30
     *
31
     * @ORM\Column(name="id", type="integer")
32
     * @ORM\Id
33
     * @ORM\GeneratedValue(strategy="AUTO")
34
     */
35
    protected $id;
36
37
    /**
38
     * @var integer
39
     * @Assert\NotBlank()
40
     *
41
     * @ORM\Column(name="row", type="integer")
42
     *
43
     * @Serializer\Groups({"get_ticket", "cget_ticket"})
44
     * @Type("integer")
45
     * @Expose()
46
     */
47
    protected $row;
48
49
    /**
50
     * @var VenueSector
51
     *
52
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\VenueSector")
53
     */
54
    protected $venueSector;
55
56
    /**
57
     * @Serializer\SerializedName("venueSectorId")
58
     * @Serializer\Accessor("getVenueSectorId")
59
     * @Type("integer")
60
     * @Expose()
61
     */
62
    protected $venueSectorId;
63
64
    /**
65
     * @var Collection
66
     *
67
     * @ORM\ManyToMany(
68
     *     targetEntity="AppBundle\Entity\PerformanceEvent",
69
     *     mappedBy="rowsForSale",
70
     *     cascade={"persist","detach","merge"}
71
     * )
72
     */
73
    protected $performanceEvent;
74
75
    /**
76
     * @var ArrayCollection|Translation[]
77
     *
78
     * @ORM\OneToMany(
79
     *     targetEntity="AppBundle\Entity\Translations\RowsForSaleTranslation",
80
     *     mappedBy="object",
81
     *     cascade={"persist", "remove"}
82
     * )
83
     */
84
    protected $translations;
85
86
    /**
87
     * @return Collection
88
     */
89
    public function getPerformanceEvent()
90
    {
91
        return $this->performanceEvent;
92
    }
93
94
    /**
95
     * @return VenueSector
96
     */
97
    public function getVenueSector()
98
    {
99
        return $this->venueSector;
100
    }
101
102
    /**
103
     * @param VenueSector $venueSector
104
     */
105
    public function setVenueSector($venueSector)
106
    {
107
        $this->venueSector = $venueSector;
108
    }
109
110
    /**
111
     * @return int
112
     */
113
    public function getRow()
114
    {
115
        return $this->row;
116
    }
117
118
    /**
119
     * @param int $row
120
     */
121
    public function setRow($row)
122
    {
123
        $this->row = $row;
124
    }
125
126
    /**
127
     * @return int
128
     */
129
    public function getId()
130
    {
131
        return $this->id;
132
    }
133
134
    public function __toString()
135
    {
136
        return $this->getVenueSector()->getTitle().' '.$this->getRow().' ряд';
137
    }
138
139
    /**
140
     * @return int
141
     */
142
    public function getVenueSectorId()
143
    {
144
        return $this->getVenueSector()->getId();
145
    }
146
}
147