]> Raphaƫl G. Git Repositories - airbundle/blob - Entity/Session.php
Restore update check
[airbundle] / Entity / Session.php
1 <?php
2
3 namespace Rapsys\AirBundle\Entity;
4
5 /**
6 * Session
7 */
8 class Session {
9 /**
10 * @var integer
11 */
12 private $id;
13
14 /**
15 * @var \DateTime
16 */
17 private $date;
18
19 /**
20 * @var \DateTime
21 */
22 private $begin;
23
24 /**
25 * @var \DateTime
26 */
27 private $start = null;
28
29 /**
30 * @var \DateTime
31 */
32 private $length;
33
34 /**
35 * @var \DateTime
36 */
37 private $stop = null;
38
39 /**
40 * @var boolean
41 */
42 private $premium;
43
44 /**
45 * @var float
46 */
47 private $rainfall;
48
49 /**
50 * @var float
51 */
52 private $rainrisk;
53
54 /**
55 * @var float
56 */
57 private $realfeel;
58
59 /**
60 * @var float
61 */
62 private $realfeelmin;
63
64 /**
65 * @var float
66 */
67 private $realfeelmax;
68
69 /**
70 * @var integer
71 */
72 private $temperature;
73
74 /**
75 * @var integer
76 */
77 private $temperaturemin;
78
79 /**
80 * @var integer
81 */
82 private $temperaturemax;
83
84 /**
85 * @var \DateTime
86 */
87 private $locked;
88
89 /**
90 * @var \DateTime
91 */
92 private $created;
93
94 /**
95 * @var \DateTime
96 */
97 private $updated;
98
99 /**
100 * @var \Rapsys\AirBundle\Entity\Application
101 */
102 private $application;
103
104 /**
105 * @var \Rapsys\AirBundle\Entity\Location
106 */
107 private $location;
108
109 /**
110 * @var \Rapsys\AirBundle\Entity\Slot
111 */
112 private $slot;
113
114 /**
115 * @var \Doctrine\Common\Collections\Collection
116 */
117 private $applications;
118
119 /**
120 * Constructor
121 */
122 public function __construct() {
123 $this->applications = new \Doctrine\Common\Collections\ArrayCollection();
124 }
125
126 /**
127 * Get id
128 *
129 * @return integer
130 */
131 public function getId() {
132 return $this->id;
133 }
134
135 /**
136 * Set date
137 *
138 * @param \DateTime $date
139 *
140 * @return Session
141 */
142 public function setDate($date) {
143 $this->date = $date;
144
145 return $this;
146 }
147
148 /**
149 * Get date
150 *
151 * @return \DateTime
152 */
153 public function getDate() {
154 return $this->date;
155 }
156
157 /**
158 * Set begin
159 *
160 * @param \DateTime $begin
161 *
162 * @return Session
163 */
164 public function setBegin($begin) {
165 $this->begin = $begin;
166
167 return $this;
168 }
169
170 /**
171 * Get begin
172 *
173 * @return \DateTime
174 */
175 public function getBegin() {
176 return $this->begin;
177 }
178
179 /**
180 * Get start
181 *
182 * @return \DateTime
183 */
184 public function getStart() {
185 //Check start
186 if ($this->start !== null) {
187 return $this->start;
188 }
189
190 //Clone date
191 $this->start = clone $this->date;
192
193 //Check if after slot
194 //XXX: id=4 <=> title=After
195 if ($this->slot->getId() == 4) {
196 //Add one day
197 $this->start->add(new \DateInterval('P1D'));
198 }
199
200 //Return date
201 return $this->start->setTime($this->begin->format('H'), $this->begin->format('i'), $this->begin->format('s'));
202 }
203
204 /**
205 * Set length
206 *
207 * @param \DateTime $length
208 *
209 * @return Session
210 */
211 public function setLength($length) {
212 $this->length = $length;
213
214 return $this;
215 }
216
217 /**
218 * Get length
219 *
220 * @return \DateTime
221 */
222 public function getLength() {
223 return $this->length;
224 }
225
226 /**
227 * Get stop
228 *
229 * @return \DateTime
230 */
231 public function getStop() {
232 //Check start
233 if ($this->stop !== null) {
234 return $this->stop;
235 }
236
237 //Get start clone
238 $this->stop = clone $this->getStart();
239
240 //Return date
241 return $this->stop->add(new \DateInterval('PT'.$this->length->format('H').'H'.$this->length->format('i').'M'.$this->length->format('s').'S'));
242 }
243
244 /**
245 * Set premium
246 *
247 * @param boolean $premium
248 *
249 * @return Session
250 */
251 public function setPremium($premium) {
252 $this->premium = $premium;
253
254 return $this;
255 }
256
257 /**
258 * Get premium
259 *
260 * @return boolean
261 */
262 public function getPremium() {
263 return $this->premium;
264 }
265
266 /**
267 * Set rainfall
268 *
269 * @param boolean $rainfall
270 *
271 * @return Session
272 */
273 public function setRainfall($rainfall) {
274 $this->rainfall = $rainfall;
275
276 return $this;
277 }
278
279 /**
280 * Get rainfall
281 *
282 * @return boolean
283 */
284 public function getRainfall() {
285 return $this->rainfall;
286 }
287
288 /**
289 * Set rainrisk
290 *
291 * @param boolean $rainrisk
292 *
293 * @return Session
294 */
295 public function setRainrisk($rainrisk) {
296 $this->rainrisk = $rainrisk;
297
298 return $this;
299 }
300
301 /**
302 * Get rainrisk
303 *
304 * @return boolean
305 */
306 public function getRainrisk() {
307 return $this->rainrisk;
308 }
309
310 /**
311 * Set realfeel
312 *
313 * @param integer $realfeel
314 *
315 * @return Session
316 */
317 public function setRealfeel($realfeel) {
318 $this->realfeel = $realfeel;
319
320 return $this;
321 }
322
323 /**
324 * Get realfeel
325 *
326 * @return integer
327 */
328 public function getRealfeel() {
329 return $this->realfeel;
330 }
331
332 /**
333 * Set realfeelmin
334 *
335 * @param integer $realfeelmin
336 *
337 * @return Session
338 */
339 public function setRealfeelmin($realfeelmin) {
340 $this->realfeelmin = $realfeelmin;
341
342 return $this;
343 }
344
345 /**
346 * Get realfeelmin
347 *
348 * @return integer
349 */
350 public function getRealfeelmin() {
351 return $this->realfeelmin;
352 }
353
354 /**
355 * Set realfeelmax
356 *
357 * @param integer $realfeelmax
358 *
359 * @return Session
360 */
361 public function setRealfeelmax($realfeelmax) {
362 $this->realfeelmax = $realfeelmax;
363
364 return $this;
365 }
366
367 /**
368 * Get realfeelmax
369 *
370 * @return integer
371 */
372 public function getRealfeelmax() {
373 return $this->realfeelmax;
374 }
375
376 /**
377 * Set temperature
378 *
379 * @param integer $temperature
380 *
381 * @return Session
382 */
383 public function setTemperature($temperature) {
384 $this->temperature = $temperature;
385
386 return $this;
387 }
388
389 /**
390 * Get temperature
391 *
392 * @return integer
393 */
394 public function getTemperature() {
395 return $this->temperature;
396 }
397
398 /**
399 * Set temperaturemin
400 *
401 * @param integer $temperaturemin
402 *
403 * @return Session
404 */
405 public function setTemperaturemin($temperaturemin) {
406 $this->temperaturemin = $temperaturemin;
407
408 return $this;
409 }
410
411 /**
412 * Get temperaturemin
413 *
414 * @return integer
415 */
416 public function getTemperaturemin() {
417 return $this->temperaturemin;
418 }
419
420 /**
421 * Set temperaturemax
422 *
423 * @param integer $temperaturemax
424 *
425 * @return Session
426 */
427 public function setTemperaturemax($temperaturemax) {
428 $this->temperaturemax = $temperaturemax;
429
430 return $this;
431 }
432
433 /**
434 * Get temperaturemax
435 *
436 * @return integer
437 */
438 public function getTemperaturemax() {
439 return $this->temperaturemax;
440 }
441
442 /**
443 * Set locked
444 *
445 * @param \DateTime $locked
446 *
447 * @return Session
448 */
449 public function setLocked($locked) {
450 $this->locked = $locked;
451
452 return $this;
453 }
454
455 /**
456 * Get locked
457 *
458 * @return \DateTime
459 */
460 public function getLocked() {
461 return $this->locked;
462 }
463
464 /**
465 * Set created
466 *
467 * @param \DateTime $created
468 *
469 * @return Session
470 */
471 public function setCreated($created) {
472 $this->created = $created;
473
474 return $this;
475 }
476
477 /**
478 * Get created
479 *
480 * @return \DateTime
481 */
482 public function getCreated() {
483 return $this->created;
484 }
485
486 /**
487 * Set updated
488 *
489 * @param \DateTime $updated
490 *
491 * @return Session
492 */
493 public function setUpdated($updated) {
494 $this->updated = $updated;
495
496 return $this;
497 }
498
499 /**
500 * Get updated
501 *
502 * @return \DateTime
503 */
504 public function getUpdated() {
505 return $this->updated;
506 }
507
508 /**
509 * Add application
510 *
511 * @param \Rapsys\AirBundle\Entity\Application $application
512 *
513 * @return Session
514 */
515 public function addApplication(\Rapsys\AirBundle\Entity\Application $application) {
516 $this->applications[] = $application;
517
518 return $this;
519 }
520
521 /**
522 * Remove application
523 *
524 * @param \Rapsys\AirBundle\Entity\Application $application
525 */
526 public function removeApplication(\Rapsys\AirBundle\Entity\Application $application) {
527 $this->applications->removeElement($application);
528 }
529
530 /**
531 * Get applications
532 *
533 * @return \Doctrine\Common\Collections\Collection
534 */
535 public function getApplications() {
536 return $this->applications;
537 }
538
539 /**
540 * Set location
541 *
542 * @param \Rapsys\AirBundle\Entity\Location $location
543 *
544 * @return Session
545 */
546 public function setLocation(\Rapsys\AirBundle\Entity\Location $location = null) {
547 $this->location = $location;
548
549 return $this;
550 }
551
552 /**
553 * Get location
554 *
555 * @return \Rapsys\AirBundle\Entity\Location
556 */
557 public function getLocation() {
558 return $this->location;
559 }
560
561 /**
562 * Set slot
563 *
564 * @param \Rapsys\AirBundle\Entity\Slot $slot
565 *
566 * @return Session
567 */
568 public function setSlot(\Rapsys\AirBundle\Entity\Slot $slot = null) {
569 $this->slot = $slot;
570
571 return $this;
572 }
573
574 /**
575 * Get slot
576 *
577 * @return \Rapsys\AirBundle\Entity\Slot
578 */
579 public function getSlot() {
580 return $this->slot;
581 }
582
583 /**
584 * Set application
585 *
586 * @param \Rapsys\AirBundle\Entity\Application $application
587 *
588 * @return Session
589 */
590 public function setApplication(\Rapsys\AirBundle\Entity\Application $application = null) {
591 $this->application = $application;
592
593 return $this;
594 }
595
596 /**
597 * Get application
598 *
599 * @return \Rapsys\AirBundle\Entity\Application
600 */
601 public function getApplication() {
602 return $this->application;
603 }
604 }