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