]> Raphaƫl G. Git Repositories - airbundle/blob - Entity/Session.php
Add application add error landing form
[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 if ($this->slot->getTitle() == 'After') {
195 //Add one day
196 $this->start->add(new \DateInterval('P1D'));
197 }
198
199 //Return date
200 return $this->start->setTime($this->begin->format('H'), $this->begin->format('i'), $this->begin->format('s'));
201 }
202
203 /**
204 * Set length
205 *
206 * @param \DateTime $length
207 *
208 * @return Session
209 */
210 public function setLength($length) {
211 $this->length = $length;
212
213 return $this;
214 }
215
216 /**
217 * Get length
218 *
219 * @return \DateTime
220 */
221 public function getLength() {
222 return $this->length;
223 }
224
225 /**
226 * Get stop
227 *
228 * @return \DateTime
229 */
230 public function getStop() {
231 //Check start
232 if ($this->stop !== null) {
233 return $this->stop;
234 }
235
236 //Get start clone
237 $this->stop = clone $this->getStart();
238
239 //Return date
240 return $this->stop->add(new \DateInterval('PT'.$this->length->format('H').'H'.$this->length->format('i').'M'.$this->length->format('s').'S'));
241 }
242
243 /**
244 * Set premium
245 *
246 * @param boolean $premium
247 *
248 * @return Session
249 */
250 public function setPremium($premium) {
251 $this->premium = $premium;
252
253 return $this;
254 }
255
256 /**
257 * Get premium
258 *
259 * @return boolean
260 */
261 public function getPremium() {
262 return $this->premium;
263 }
264
265 /**
266 * Set rainfall
267 *
268 * @param boolean $rainfall
269 *
270 * @return Session
271 */
272 public function setRainfall($rainfall) {
273 $this->rainfall = $rainfall;
274
275 return $this;
276 }
277
278 /**
279 * Get rainfall
280 *
281 * @return boolean
282 */
283 public function getRainfall() {
284 return $this->rainfall;
285 }
286
287 /**
288 * Set rainrisk
289 *
290 * @param boolean $rainrisk
291 *
292 * @return Session
293 */
294 public function setRainrisk($rainrisk) {
295 $this->rainrisk = $rainrisk;
296
297 return $this;
298 }
299
300 /**
301 * Get rainrisk
302 *
303 * @return boolean
304 */
305 public function getRainrisk() {
306 return $this->rainrisk;
307 }
308
309 /**
310 * Set realfeel
311 *
312 * @param integer $realfeel
313 *
314 * @return Session
315 */
316 public function setRealfeel($realfeel) {
317 $this->realfeel = $realfeel;
318
319 return $this;
320 }
321
322 /**
323 * Get realfeel
324 *
325 * @return integer
326 */
327 public function getRealfeel() {
328 return $this->realfeel;
329 }
330
331 /**
332 * Set realfeelmin
333 *
334 * @param integer $realfeelmin
335 *
336 * @return Session
337 */
338 public function setRealfeelmin($realfeelmin) {
339 $this->realfeelmin = $realfeelmin;
340
341 return $this;
342 }
343
344 /**
345 * Get realfeelmin
346 *
347 * @return integer
348 */
349 public function getRealfeelmin() {
350 return $this->realfeelmin;
351 }
352
353 /**
354 * Set realfeelmax
355 *
356 * @param integer $realfeelmax
357 *
358 * @return Session
359 */
360 public function setRealfeelmax($realfeelmax) {
361 $this->realfeelmax = $realfeelmax;
362
363 return $this;
364 }
365
366 /**
367 * Get realfeelmax
368 *
369 * @return integer
370 */
371 public function getRealfeelmax() {
372 return $this->realfeelmax;
373 }
374
375 /**
376 * Set temperature
377 *
378 * @param integer $temperature
379 *
380 * @return Session
381 */
382 public function setTemperature($temperature) {
383 $this->temperature = $temperature;
384
385 return $this;
386 }
387
388 /**
389 * Get temperature
390 *
391 * @return integer
392 */
393 public function getTemperature() {
394 return $this->temperature;
395 }
396
397 /**
398 * Set temperaturemin
399 *
400 * @param integer $temperaturemin
401 *
402 * @return Session
403 */
404 public function setTemperaturemin($temperaturemin) {
405 $this->temperaturemin = $temperaturemin;
406
407 return $this;
408 }
409
410 /**
411 * Get temperaturemin
412 *
413 * @return integer
414 */
415 public function getTemperaturemin() {
416 return $this->temperaturemin;
417 }
418
419 /**
420 * Set temperaturemax
421 *
422 * @param integer $temperaturemax
423 *
424 * @return Session
425 */
426 public function setTemperaturemax($temperaturemax) {
427 $this->temperaturemax = $temperaturemax;
428
429 return $this;
430 }
431
432 /**
433 * Get temperaturemax
434 *
435 * @return integer
436 */
437 public function getTemperaturemax() {
438 return $this->temperaturemax;
439 }
440
441 /**
442 * Set locked
443 *
444 * @param \DateTime $locked
445 *
446 * @return Session
447 */
448 public function setLocked($locked) {
449 $this->locked = $locked;
450
451 return $this;
452 }
453
454 /**
455 * Get locked
456 *
457 * @return \DateTime
458 */
459 public function getLocked() {
460 return $this->locked;
461 }
462
463 /**
464 * Set created
465 *
466 * @param \DateTime $created
467 *
468 * @return Session
469 */
470 public function setCreated($created) {
471 $this->created = $created;
472
473 return $this;
474 }
475
476 /**
477 * Get created
478 *
479 * @return \DateTime
480 */
481 public function getCreated() {
482 return $this->created;
483 }
484
485 /**
486 * Set updated
487 *
488 * @param \DateTime $updated
489 *
490 * @return Session
491 */
492 public function setUpdated($updated) {
493 $this->updated = $updated;
494
495 return $this;
496 }
497
498 /**
499 * Get updated
500 *
501 * @return \DateTime
502 */
503 public function getUpdated() {
504 return $this->updated;
505 }
506
507 /**
508 * Add application
509 *
510 * @param \Rapsys\AirBundle\Entity\Application $application
511 *
512 * @return Session
513 */
514 public function addApplication(\Rapsys\AirBundle\Entity\Application $application) {
515 $this->applications[] = $application;
516
517 return $this;
518 }
519
520 /**
521 * Remove application
522 *
523 * @param \Rapsys\AirBundle\Entity\Application $application
524 */
525 public function removeApplication(\Rapsys\AirBundle\Entity\Application $application) {
526 $this->applications->removeElement($application);
527 }
528
529 /**
530 * Get applications
531 *
532 * @return \Doctrine\Common\Collections\Collection
533 */
534 public function getApplications() {
535 return $this->applications;
536 }
537
538 /**
539 * Set location
540 *
541 * @param \Rapsys\AirBundle\Entity\Location $location
542 *
543 * @return Session
544 */
545 public function setLocation(\Rapsys\AirBundle\Entity\Location $location = null) {
546 $this->location = $location;
547
548 return $this;
549 }
550
551 /**
552 * Get location
553 *
554 * @return \Rapsys\AirBundle\Entity\Location
555 */
556 public function getLocation() {
557 return $this->location;
558 }
559
560 /**
561 * Set slot
562 *
563 * @param \Rapsys\AirBundle\Entity\Slot $slot
564 *
565 * @return Session
566 */
567 public function setSlot(\Rapsys\AirBundle\Entity\Slot $slot = null) {
568 $this->slot = $slot;
569
570 return $this;
571 }
572
573 /**
574 * Get slot
575 *
576 * @return \Rapsys\AirBundle\Entity\Slot
577 */
578 public function getSlot() {
579 return $this->slot;
580 }
581
582 /**
583 * Set application
584 *
585 * @param \Rapsys\AirBundle\Entity\Application $application
586 *
587 * @return Session
588 */
589 public function setApplication(\Rapsys\AirBundle\Entity\Application $application = null) {
590 $this->application = $application;
591
592 return $this;
593 }
594
595 /**
596 * Get application
597 *
598 * @return \Rapsys\AirBundle\Entity\Application
599 */
600 public function getApplication() {
601 return $this->application;
602 }
603 }