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
|
|
|
* VenueSector constructor. |
77
|
|
|
*/ |
78
|
|
|
public function __construct() |
79
|
|
|
{ |
80
|
|
|
parent::__construct(); |
81
|
|
|
$this->seats = new ArrayCollection(); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return integer |
86
|
|
|
*/ |
87
|
|
|
public function getId() |
88
|
|
|
{ |
89
|
|
|
return $this->id; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return VenueSector |
94
|
|
|
*/ |
95
|
|
|
public function unsetTranslations() |
96
|
|
|
{ |
97
|
|
|
$this->translations = null; |
98
|
|
|
|
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return string |
104
|
|
|
*/ |
105
|
|
|
public function getTitle() |
106
|
|
|
{ |
107
|
|
|
return $this->title; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @param string $title |
112
|
|
|
* @return VenueSector |
113
|
|
|
*/ |
114
|
|
|
public function setTitle($title) |
115
|
|
|
{ |
116
|
|
|
$this->title = $title; |
117
|
|
|
|
118
|
|
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return Venue |
123
|
|
|
*/ |
124
|
|
|
public function getVenue() |
125
|
|
|
{ |
126
|
|
|
return $this->venue; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @param Seat $seat |
131
|
|
|
* @return VenueSector |
132
|
|
|
*/ |
133
|
|
|
public function addSeat(Seat $seat) |
134
|
|
|
{ |
135
|
|
|
$this->seats[] = $seat; |
136
|
|
|
|
137
|
|
|
return $this; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @param Seat $seat |
142
|
|
|
*/ |
143
|
|
|
public function removeSeat(Seat $seat) |
144
|
|
|
{ |
145
|
|
|
$this->seats->removeElement($seat); |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @return Collection |
150
|
|
|
*/ |
151
|
|
|
public function getSeat() |
152
|
|
|
{ |
153
|
|
|
return $this->seats; |
|
|
|
|
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @return string |
158
|
|
|
*/ |
159
|
|
|
public function __toString() |
160
|
|
|
{ |
161
|
|
|
return $this->getTitle(); |
162
|
|
|
} |
163
|
|
|
} |
164
|
|
|
|