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