1 | <?php |
||
27 | class PerformanceEvent extends AbstractPersonalTranslatable implements TranslatableInterface |
||
28 | { |
||
29 | use TimestampableTrait, BlameableEntity, DeletedByTrait; |
||
30 | |||
31 | const VENUE_PHILHARMONIC = "venue-philharmonic"; |
||
32 | const VENUE_KULIC_HOUSE = "venue-kilic-house"; |
||
33 | const VENUE_THEATRE = "venue-theatre"; |
||
34 | |||
35 | public static $venues = [ |
||
36 | self::VENUE_PHILHARMONIC => self::VENUE_PHILHARMONIC, |
||
37 | self::VENUE_KULIC_HOUSE => self::VENUE_KULIC_HOUSE, |
||
38 | self::VENUE_THEATRE => self::VENUE_THEATRE, |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * @var integer |
||
43 | * |
||
44 | * @ORM\Column(name="id", type="integer") |
||
45 | * @ORM\Id |
||
46 | * @ORM\GeneratedValue(strategy="AUTO") |
||
47 | * @Type("integer") |
||
48 | * @Expose |
||
49 | */ |
||
50 | private $id; |
||
51 | |||
52 | /** |
||
53 | * @var Performance |
||
54 | * |
||
55 | * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Performance", inversedBy="performanceEvents") |
||
56 | * @Type("AppBundle\Entity\Performance") |
||
57 | * @Expose |
||
58 | */ |
||
59 | private $performance; |
||
60 | |||
61 | /** |
||
62 | * @var /Datetime |
||
63 | * |
||
64 | * @Assert\NotBlank() |
||
65 | * @ORM\Column(type="datetime") |
||
66 | * @Type("DateTime") |
||
67 | * @Expose |
||
68 | */ |
||
69 | private $dateTime; |
||
70 | |||
71 | /** |
||
72 | * Place where performance happens |
||
73 | * @var string |
||
74 | * @ORM\Column(type="string") |
||
75 | * @Type("string") |
||
76 | * @Expose |
||
77 | */ |
||
78 | private $venue; |
||
79 | |||
80 | /** |
||
81 | * @var int |
||
82 | * |
||
83 | * @Type("integer") |
||
84 | * @Expose |
||
85 | * @Accessor(getter="getYear") |
||
86 | */ |
||
87 | private $year; |
||
88 | |||
89 | /** |
||
90 | * @var int |
||
91 | * |
||
92 | * @Expose |
||
93 | * @Accessor(getter="getMonth") |
||
94 | */ |
||
95 | private $month; |
||
96 | |||
97 | /** |
||
98 | * @var int |
||
99 | * |
||
100 | * @Expose |
||
101 | * @Accessor(getter="getDay") |
||
102 | */ |
||
103 | private $day; |
||
104 | |||
105 | /** |
||
106 | * @var string |
||
107 | * |
||
108 | * @Expose |
||
109 | * @Accessor(getter="getTime") |
||
110 | */ |
||
111 | private $time; |
||
112 | |||
113 | /** |
||
114 | * @var ArrayCollection |
||
115 | * |
||
116 | * @ORM\OneToMany( |
||
117 | * targetEntity="AppBundle\Entity\Translations\PerformanceEventTranslation", |
||
118 | * mappedBy="object", |
||
119 | * cascade={"persist", "remove"} |
||
120 | * ) |
||
121 | */ |
||
122 | protected $translations; |
||
123 | |||
124 | /** |
||
125 | * Unset translations |
||
126 | * |
||
127 | * @return PerformanceEvent |
||
128 | */ |
||
129 | 4 | public function unsetTranslations() |
|
135 | |||
136 | /** |
||
137 | * Get id |
||
138 | * |
||
139 | * @return integer |
||
140 | */ |
||
141 | 9 | public function getId() |
|
145 | |||
146 | /** |
||
147 | * Set dateTime |
||
148 | * |
||
149 | * @param \DateTime $dateTime |
||
150 | * @return PerformanceEvent |
||
151 | */ |
||
152 | 7 | public function setDateTime($dateTime) |
|
158 | |||
159 | /** |
||
160 | * Get dateTime |
||
161 | * |
||
162 | * @return \DateTime |
||
163 | */ |
||
164 | 12 | public function getDateTime() |
|
168 | |||
169 | /** |
||
170 | * Set performance |
||
171 | * |
||
172 | * @param \AppBundle\Entity\Performance $performance |
||
173 | * @return PerformanceEvent |
||
174 | */ |
||
175 | public function setPerformance(\AppBundle\Entity\Performance $performance = null) |
||
181 | |||
182 | /** |
||
183 | * Get performance |
||
184 | * |
||
185 | * @return \AppBundle\Entity\Performance |
||
186 | */ |
||
187 | 3 | public function getPerformance() |
|
191 | |||
192 | 1 | public function __toString() |
|
193 | { |
||
194 | 1 | if ($this->getDateTime()) { |
|
195 | 1 | return $this->getDateTime()->format('d-m-Y H:i'); |
|
196 | } |
||
197 | |||
198 | return date("F j, Y, g:i a"); |
||
199 | } |
||
200 | |||
201 | /** |
||
202 | * @return mixed |
||
203 | */ |
||
204 | 4 | public function getYear() |
|
208 | |||
209 | /** |
||
210 | * @param mixed $year |
||
211 | */ |
||
212 | public function setYear($year) |
||
216 | |||
217 | /** |
||
218 | * @return int |
||
219 | */ |
||
220 | 4 | public function getMonth() |
|
224 | |||
225 | /** |
||
226 | * @param int $month |
||
227 | */ |
||
228 | public function setMonth($month) |
||
232 | |||
233 | /** |
||
234 | * @return int |
||
235 | */ |
||
236 | 4 | public function getDay() |
|
240 | |||
241 | /** |
||
242 | * @param int $day |
||
243 | */ |
||
244 | public function setDay($day) |
||
248 | |||
249 | /** |
||
250 | * @return string |
||
251 | */ |
||
252 | 4 | public function getTime() |
|
256 | |||
257 | /** |
||
258 | * @param string $time |
||
259 | */ |
||
260 | public function setTime($time) |
||
264 | |||
265 | /** |
||
266 | * @return string |
||
267 | */ |
||
268 | 4 | public function getVenue() |
|
272 | |||
273 | /** |
||
274 | * @param string $venue |
||
275 | */ |
||
276 | 4 | public function setVenue($venue) |
|
280 | } |
||
281 |