]> Raphaël G. Git Repositories - airbundle/blob - Entity/Application.php
Add google calendar entity
[airbundle] / Entity / Application.php
1 <?php declare(strict_types=1);
2
3 /*
4 * this file is part of the rapsys packbundle package.
5 *
6 * (c) raphaël gertz <symfony@rapsys.eu>
7 *
8 * for the full copyright and license information, please view the license
9 * file that was distributed with this source code.
10 */
11
12 namespace Rapsys\AirBundle\Entity;
13
14 use Doctrine\ORM\Event\PreUpdateEventArgs;
15
16 /**
17 * Application
18 */
19 class Application {
20 /**
21 * @var integer
22 */
23 private $id;
24
25 /**
26 * @var Dance
27 */
28 private $dance;
29
30 /**
31 * @var float
32 */
33 private $score;
34
35 /**
36 * @var \DateTime
37 */
38 private $canceled;
39
40 /**
41 * @var \DateTime
42 */
43 private $created;
44
45 /**
46 * @var \DateTime
47 */
48 private $updated;
49
50 /**
51 * @var \Rapsys\AirBundle\Entity\Session
52 */
53 private $session;
54
55 /**
56 * @var \Rapsys\AirBundle\Entity\User
57 */
58 private $user;
59
60 /**
61 * Constructor
62 */
63 public function __construct() {
64 //Set defaults
65 $this->score = null;
66 $this->canceled = null;
67 $this->created = new \DateTime('now');
68 $this->updated = new \DateTime('now');
69 $this->session = null;
70 $this->user = null;
71 }
72
73 /**
74 * Get id
75 *
76 * @return integer
77 */
78 public function getId(): int {
79 return $this->id;
80 }
81
82 /**
83 * Set dance
84 *
85 * @param Dance $dance
86 *
87 * @return Application
88 */
89 public function setDance(Dance $dance): Application {
90 $this->dance = $dance;
91
92 return $this;
93 }
94
95 /**
96 * Get dance
97 *
98 * @return Dance
99 */
100 public function getDance(): Dance {
101 return $this->dance;
102 }
103
104 /**
105 * Set score
106 *
107 * @param float $score
108 *
109 * @return Application
110 */
111 public function setScore(?float $score): Application {
112 $this->score = $score;
113
114 return $this;
115 }
116
117 /**
118 * Get score
119 *
120 * @return float
121 */
122 public function getScore(): ?float {
123 return $this->score;
124 }
125
126 /**
127 * Set canceled
128 *
129 * @param \DateTime $canceled
130 *
131 * @return Application
132 */
133 public function setCanceled(?\DateTime $canceled): Application {
134 $this->canceled = $canceled;
135
136 return $this;
137 }
138
139 /**
140 * Get canceled
141 *
142 * @return \DateTime
143 */
144 public function getCanceled(): ?\DateTime {
145 return $this->canceled;
146 }
147
148 /**
149 * Set created
150 *
151 * @param \DateTime $created
152 *
153 * @return Application
154 */
155 public function setCreated(\DateTime $created): Application {
156 $this->created = $created;
157
158 return $this;
159 }
160
161 /**
162 * Get created
163 *
164 * @return \DateTime
165 */
166 public function getCreated(): \DateTime {
167 return $this->created;
168 }
169
170 /**
171 * Set updated
172 *
173 * @param \DateTime $updated
174 *
175 * @return Application
176 */
177 public function setUpdated(\DateTime $updated): Application {
178 $this->updated = $updated;
179
180 return $this;
181 }
182
183 /**
184 * Get updated
185 *
186 * @return \DateTime
187 */
188 public function getUpdated(): \DateTime {
189 return $this->updated;
190 }
191
192 /**
193 * Set session
194 *
195 * @param Session $session
196 *
197 * @return Application
198 */
199 public function setSession(Session $session): Application {
200 $this->session = $session;
201
202 return $this;
203 }
204
205 /**
206 * Get session
207 *
208 * @return Session
209 */
210 public function getSession(): Session {
211 return $this->session;
212 }
213
214 /**
215 * Set user
216 *
217 * @param User $user
218 *
219 * @return Application
220 */
221 public function setUser(User $user): Application {
222 $this->user = $user;
223
224 return $this;
225 }
226
227 /**
228 * Get user
229 *
230 * @return User
231 */
232 public function getUser(): User {
233 return $this->user;
234 }
235
236 /**
237 * {@inheritdoc}
238 */
239 public function preUpdate(PreUpdateEventArgs $eventArgs) {
240 //Check that we have an application instance
241 if (($application = $eventArgs->getEntity()) instanceof Application) {
242 //Set updated value
243 $application->setUpdated(new \DateTime('now'));
244 }
245 }
246 }