]> Raphaƫl G. Git Repositories - airbundle/blob - Entity/Slot.php
Makes base template clean
[airbundle] / Entity / Slot.php
1 <?php
2
3 namespace Rapsys\AirBundle\Entity;
4
5 /**
6 * Slot
7 */
8 class Slot
9 {
10 /**
11 * @var integer
12 */
13 private $id;
14
15 /**
16 * @var \DateTime
17 */
18 private $begin;
19
20 /**
21 * @var \DateTime
22 */
23 private $length;
24
25 /**
26 * @var \DateTime
27 */
28 private $created;
29
30 /**
31 * @var \DateTime
32 */
33 private $updated;
34
35 /**
36 * @var \Doctrine\Common\Collections\Collection
37 */
38 private $sessions;
39
40 /**
41 * Constructor
42 */
43 public function __construct()
44 {
45 $this->sessions = new \Doctrine\Common\Collections\ArrayCollection();
46 }
47
48 /**
49 * Get id
50 *
51 * @return integer
52 */
53 public function getId()
54 {
55 return $this->id;
56 }
57
58 /**
59 * Set begin
60 *
61 * @param \DateTime $begin
62 *
63 * @return Slot
64 */
65 public function setBegin($begin)
66 {
67 $this->begin = $begin;
68
69 return $this;
70 }
71
72 /**
73 * Get begin
74 *
75 * @return \DateTime
76 */
77 public function getBegin()
78 {
79 return $this->begin;
80 }
81
82 /**
83 * Set length
84 *
85 * @param \DateTime $length
86 *
87 * @return Slot
88 */
89 public function setLength($length)
90 {
91 $this->length = $length;
92
93 return $this;
94 }
95
96 /**
97 * Get length
98 *
99 * @return \DateTime
100 */
101 public function getLength()
102 {
103 return $this->length;
104 }
105
106 /**
107 * Set created
108 *
109 * @param \DateTime $created
110 *
111 * @return Slot
112 */
113 public function setCreated($created)
114 {
115 $this->created = $created;
116
117 return $this;
118 }
119
120 /**
121 * Get created
122 *
123 * @return \DateTime
124 */
125 public function getCreated()
126 {
127 return $this->created;
128 }
129
130 /**
131 * Set updated
132 *
133 * @param \DateTime $updated
134 *
135 * @return Slot
136 */
137 public function setUpdated($updated)
138 {
139 $this->updated = $updated;
140
141 return $this;
142 }
143
144 /**
145 * Get updated
146 *
147 * @return \DateTime
148 */
149 public function getUpdated()
150 {
151 return $this->updated;
152 }
153
154 /**
155 * Add session
156 *
157 * @param \Rapsys\AirBundle\Entity\Session $session
158 *
159 * @return Slot
160 */
161 public function addSession(\Rapsys\AirBundle\Entity\Session $session)
162 {
163 $this->sessions[] = $session;
164
165 return $this;
166 }
167
168 /**
169 * Remove session
170 *
171 * @param \Rapsys\AirBundle\Entity\Session $session
172 */
173 public function removeSession(\Rapsys\AirBundle\Entity\Session $session)
174 {
175 $this->sessions->removeElement($session);
176 }
177
178 /**
179 * Get sessions
180 *
181 * @return \Doctrine\Common\Collections\Collection
182 */
183 public function getSessions()
184 {
185 return $this->sessions;
186 }
187
188 public function getTitle() {
189 //TODO: replace that with computed time
190 return $this->begin->format('H:i').'+'.$this->length->format('H:i');
191 }
192 }