]> Raphaël G. Git Repositories - airbundle/blob - Entity/Application.php
Add strict
[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 $this->session = null;
65 $this->user = null;
66 }
67
68 /**
69 * Get id
70 *
71 * @return integer
72 */
73 public function getId(): int {
74 return $this->id;
75 }
76
77 /**
78 * Set dance
79 *
80 * @param Dance $dance
81 *
82 * @return Session
83 */
84 public function setDance(Dance $dance): Session {
85 $this->dance = $dance;
86
87 return $this;
88 }
89
90 /**
91 * Get dance
92 *
93 * @return Dance
94 */
95 public function getDance(): Dance {
96 return $this->dance;
97 }
98
99 /**
100 * Set score
101 *
102 * @param float $score
103 *
104 * @return Application
105 */
106 public function setScore(?float $score): Application {
107 $this->score = $score;
108
109 return $this;
110 }
111
112 /**
113 * Get score
114 *
115 * @return float
116 */
117 public function getScore(): ?float {
118 return $this->score;
119 }
120
121 /**
122 * Set canceled
123 *
124 * @param \DateTime $canceled
125 *
126 * @return Application
127 */
128 public function setCanceled(?\DateTime $canceled): Application {
129 $this->canceled = $canceled;
130
131 return $this;
132 }
133
134 /**
135 * Get canceled
136 *
137 * @return \DateTime
138 */
139 public function getCanceled(): ?\DateTime {
140 return $this->canceled;
141 }
142
143 /**
144 * Set created
145 *
146 * @param \DateTime $created
147 *
148 * @return Application
149 */
150 public function setCreated(\DateTime $created): Application {
151 $this->created = $created;
152
153 return $this;
154 }
155
156 /**
157 * Get created
158 *
159 * @return \DateTime
160 */
161 public function getCreated(): \DateTime {
162 return $this->created;
163 }
164
165 /**
166 * Set updated
167 *
168 * @param \DateTime $updated
169 *
170 * @return Application
171 */
172 public function setUpdated(\DateTime $updated): Application {
173 $this->updated = $updated;
174
175 return $this;
176 }
177
178 /**
179 * Get updated
180 *
181 * @return \DateTime
182 */
183 public function getUpdated(): \DateTime {
184 return $this->updated;
185 }
186
187 /**
188 * Set session
189 *
190 * @param Session $session
191 *
192 * @return Application
193 */
194 public function setSession(Session $session): Application {
195 $this->session = $session;
196
197 return $this;
198 }
199
200 /**
201 * Get session
202 *
203 * @return Session
204 */
205 public function getSession(): Session {
206 return $this->session;
207 }
208
209 /**
210 * Set user
211 *
212 * @param User $user
213 *
214 * @return Application
215 */
216 public function setUser(User $user): Application {
217 $this->user = $user;
218
219 return $this;
220 }
221
222 /**
223 * Get user
224 *
225 * @return User
226 */
227 public function getUser(): User {
228 return $this->user;
229 }
230
231 /**
232 * {@inheritdoc}
233 */
234 public function preUpdate(PreUpdateEventArgs $eventArgs) {
235 //Check that we have an application instance
236 if (($application = $eventArgs->getEntity()) instanceof Application) {
237 //Set updated value
238 $application->setUpdated(new \DateTime('now'));
239 }
240 }
241 }