]> Raphaël G. Git Repositories - airbundle/blob - Entity/Snippet.php
Fix logo placement
[airbundle] / Entity / Snippet.php
1 <?php declare(strict_types=1);
2
3 /*
4 * this file is part of the rapsys packbundle package.
5 *
6 * (c) raphaël gertz <symfony@rapsys.eu>
7 *
8 * for the full copyright and license information, please view the license
9 * file that was distributed with this source code.
10 */
11
12 namespace Rapsys\AirBundle\Entity;
13
14 use Doctrine\ORM\Event\PreUpdateEventArgs;
15
16 /**
17 * Snippet
18 */
19 class Snippet {
20 /**
21 * @var integer
22 */
23 private $id;
24
25 /**
26 * @var string
27 */
28 protected $locale;
29
30 /**
31 * @var string
32 */
33 protected $description;
34
35 /**
36 * @var string
37 */
38 protected $class;
39
40 /**
41 * @var string
42 */
43 protected $short;
44
45 /**
46 * @var integer
47 */
48 protected $rate;
49
50 /**
51 * @var bool
52 */
53 protected $hat;
54
55 /**
56 * @var string
57 */
58 protected $contact;
59
60 /**
61 * @var string
62 */
63 protected $donate;
64
65 /**
66 * @var string
67 */
68 protected $link;
69
70 /**
71 * @var string
72 */
73 protected $profile;
74
75 /**
76 * @var \DateTime
77 */
78 protected $created;
79
80 /**
81 * @var \DateTime
82 */
83 protected $updated;
84
85 /**
86 * @var Location
87 */
88 protected $location;
89
90 /**
91 * @var User
92 */
93 protected $user;
94
95 /**
96 * Constructor
97 */
98 public function __construct() {
99 $this->description = null;
100 $this->class = null;
101 $this->short = null;
102 $this->rate = null;
103 $this->hat = null;
104 $this->contact = null;
105 $this->donate = null;
106 $this->link = null;
107 $this->profile = null;
108 }
109
110 /**
111 * Get id
112 *
113 * @return integer
114 */
115 public function getId(): int {
116 return $this->id;
117 }
118
119 /**
120 * Set locale
121 *
122 * @param string $locale
123 *
124 * @return Snippet
125 */
126 public function setLocale(string $locale): Snippet {
127 $this->locale = $locale;
128
129 return $this;
130 }
131
132 /**
133 * Get locale
134 *
135 * @return string
136 */
137 public function getLocale(): string {
138 return $this->locale;
139 }
140
141 /**
142 * Set description
143 *
144 * @param string $description
145 *
146 * @return Snippet
147 */
148 public function setDescription(?string $description): Snippet {
149 $this->description = $description;
150
151 return $this;
152 }
153
154 /**
155 * Get description
156 *
157 * @return string
158 */
159 public function getDescription(): ?string {
160 return $this->description;
161 }
162
163 /**
164 * Set class
165 *
166 * @param string $class
167 *
168 * @return Snippet
169 */
170 public function setClass(?string $class): Snippet {
171 $this->class = $class;
172
173 return $this;
174 }
175
176 /**
177 * Get class
178 *
179 * @return string
180 */
181 public function getClass(): ?string {
182 return $this->class;
183 }
184
185 /**
186 * Set short
187 *
188 * @param string $short
189 *
190 * @return Snippet
191 */
192 public function setShort(?string $short): Snippet {
193 $this->short = $short;
194
195 return $this;
196 }
197
198 /**
199 * Get short
200 *
201 * @return string
202 */
203 public function getShort(): ?string {
204 return $this->short;
205 }
206
207 /**
208 * Set rate
209 *
210 * @param int $rate
211 *
212 * @return Snippet
213 */
214 public function setRate(?int $rate): Snippet {
215 $this->rate = $rate;
216
217 return $this;
218 }
219
220 /**
221 * Get rate
222 *
223 * @return int
224 */
225 public function getRate(): ?int {
226 return $this->rate;
227 }
228
229 /**
230 * Set hat
231 *
232 * @param bool $hat
233 *
234 * @return User
235 */
236 public function setHat(?bool $hat): Snippet {
237 $this->hat = $hat;
238
239 return $this;
240 }
241
242 /**
243 * Get hat
244 *
245 * @return bool
246 */
247 public function getHat(): ?bool {
248 return $this->hat;
249 }
250 /**
251 * Set contact
252 *
253 * @param string $contact
254 *
255 * @return Snippet
256 */
257 public function setContact(?string $contact): Snippet {
258 $this->contact = $contact;
259
260 return $this;
261 }
262
263 /**
264 * Get contact
265 *
266 * @return string
267 */
268 public function getContact(): ?string {
269 return $this->contact;
270 }
271
272 /**
273 * Set donate
274 *
275 * @param string $donate
276 *
277 * @return Snippet
278 */
279 public function setDonate(?string $donate): Snippet {
280 $this->donate = $donate;
281
282 return $this;
283 }
284
285 /**
286 * Get donate
287 *
288 * @return string
289 */
290 public function getDonate(): ?string {
291 return $this->donate;
292 }
293
294 /**
295 * Set link
296 *
297 * @param string $link
298 *
299 * @return Snippet
300 */
301 public function setLink(?string $link): Snippet {
302 $this->link = $link;
303
304 return $this;
305 }
306
307 /**
308 * Get link
309 *
310 * @return string
311 */
312 public function getLink(): ?string {
313 return $this->link;
314 }
315
316 /**
317 * Set profile
318 *
319 * @param string $profile
320 *
321 * @return Snippet
322 */
323 public function setProfile(?string $profile): Snippet {
324 $this->profile = $profile;
325
326 return $this;
327 }
328
329 /**
330 * Get profile
331 *
332 * @return string
333 */
334 public function getProfile(): ?string {
335 return $this->profile;
336 }
337
338 /**
339 * Set created
340 *
341 * @param \DateTime $created
342 *
343 * @return Snippet
344 */
345 public function setCreated(\DateTime $created): Snippet {
346 $this->created = $created;
347
348 return $this;
349 }
350
351 /**
352 * Get created
353 *
354 * @return \DateTime
355 */
356 public function getCreated(): \DateTime {
357 return $this->created;
358 }
359
360 /**
361 * Set updated
362 *
363 * @param \DateTime $updated
364 *
365 * @return Snippet
366 */
367 public function setUpdated(\DateTime $updated): Snippet {
368 $this->updated = $updated;
369
370 return $this;
371 }
372
373 /**
374 * Get updated
375 *
376 * @return \DateTime
377 */
378 public function getUpdated(): \DateTime {
379 return $this->updated;
380 }
381
382 /**
383 * Set location
384 *
385 * @param Location $location
386 *
387 * @return Snippet
388 */
389 public function setLocation(Location $location) {
390 $this->location = $location;
391
392 return $this;
393 }
394
395 /**
396 * Get location
397 *
398 * @return Location
399 */
400 public function getLocation() {
401 return $this->location;
402 }
403
404 /**
405 * Set user
406 *
407 * @param User $user
408 *
409 * @return Snippet
410 */
411 public function setUser(User $user) {
412 $this->user = $user;
413
414 return $this;
415 }
416
417 /**
418 * Get user
419 *
420 * @return User
421 */
422 public function getUser() {
423 return $this->user;
424 }
425
426 /**
427 * {@inheritdoc}
428 */
429 public function preUpdate(\Doctrine\ORM\Event\PreUpdateEventArgs $eventArgs) {
430 //Check that we have an snippet instance
431 if (($snippet = $eventArgs->getEntity()) instanceof Snippet) {
432 //Set updated value
433 $snippet->setUpdated(new \DateTime('now'));
434 }
435 }
436 }