Completed
Push — master ( 28be56...359087 )
by Serhii
13:20
created

RowsForSale   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 108
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 108
rs 10
c 0
b 0
f 0
wmc 7
lcom 0
cbo 2

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getPerformanceEvent() 0 4 1
A getVenueSector() 0 4 1
A setVenueSector() 0 4 1
A getRow() 0 4 1
A setRow() 0 4 1
A getId() 0 4 1
A __toString() 0 4 1
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
     * @Type("AppBundle\Entity\VenueSector")
54
     * @Expose()
55
     */
56
    protected $venueSector;
57
58
    /**
59
     * @var Collection
60
     *
61
     * @ORM\ManyToMany(
62
     *     targetEntity="AppBundle\Entity\PerformanceEvent",
63
     *     mappedBy="rowsForSale",
64
     *     cascade={"persist","detach","merge"}
65
     * )
66
     */
67
    protected $performanceEvent;
68
69
    /**
70
     * @var ArrayCollection|Translation[]
71
     *
72
     * @ORM\OneToMany(
73
     *     targetEntity="AppBundle\Entity\Translations\RowsForSaleTranslation",
74
     *     mappedBy="object",
75
     *     cascade={"persist", "remove"}
76
     * )
77
     */
78
    protected $translations;
79
80
81
    /**
82
     * @return Collection
83
     */
84
    public function getPerformanceEvent()
85
    {
86
        return $this->performanceEvent;
87
    }
88
89
    /**
90
     * @return VenueSector
91
     */
92
    public function getVenueSector()
93
    {
94
        return $this->venueSector;
95
    }
96
97
    /**
98
     * @param VenueSector $venueSector
99
     */
100
    public function setVenueSector($venueSector)
101
    {
102
        $this->venueSector = $venueSector;
103
    }
104
105
    /**
106
     * @return int
107
     */
108
    public function getRow()
109
    {
110
        return $this->row;
111
    }
112
113
    /**
114
     * @param int $row
115
     */
116
    public function setRow($row)
117
    {
118
        $this->row = $row;
119
    }
120
121
    /**
122
     * @return int
123
     */
124
    public function getId()
125
    {
126
        return $this->id;
127
    }
128
129
    public function __toString()
130
    {
131
        return $this->getVenueSector()->getTitle().' '.$this->getRow().' ряд';
132
    }
133
}
134