1 | <?php |
||
16 | class User implements AdvancedUserInterface, \Serializable |
||
17 | { |
||
18 | use ORMBehaviors\Timestampable\Timestampable; |
||
19 | /** |
||
20 | * @var int |
||
21 | * |
||
22 | * @ORM\Column(type="integer") |
||
23 | * @ORM\Id |
||
24 | * @ORM\GeneratedValue(strategy="AUTO") |
||
25 | */ |
||
26 | private $id; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | * @Assert\NotBlank() |
||
31 | * @Assert\Regex( |
||
32 | * pattern="/\d/", |
||
33 | * match=false, |
||
34 | * message="Your name cannot contain a number" |
||
35 | * ) |
||
36 | * @Assert\Type("string") |
||
37 | * @Assert\Length( |
||
38 | * min = 2, |
||
39 | * max = 190 |
||
40 | * ) |
||
41 | * @ORM\Column(type="string", length=190) |
||
42 | */ |
||
43 | private $firstName; |
||
44 | |||
45 | /** |
||
46 | * @var string |
||
47 | * @Assert\Regex( |
||
48 | * pattern="/\d/", |
||
49 | * match=false, |
||
50 | * message="Your lastname cannot contain a number" |
||
51 | * ) |
||
52 | * @Assert\Type("string") |
||
53 | * @Assert\Length( |
||
54 | * max = 190 |
||
55 | * ) |
||
56 | * @ORM\Column(type="string", length=190, nullable=true) |
||
57 | */ |
||
58 | private $lastName; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | * @Assert\Image() |
||
63 | * @ORM\Column(type="string", nullable=true) |
||
64 | */ |
||
65 | private $image; |
||
66 | |||
67 | /** |
||
68 | * @var string |
||
69 | * @Assert\Email( |
||
70 | * checkMX = true |
||
71 | * ) |
||
72 | * @Assert\Type("string") |
||
73 | * @Assert\Length( |
||
74 | * max = 250 |
||
75 | * ) |
||
76 | * @ORM\Column(type="string", length=250, unique=true) |
||
77 | */ |
||
78 | private $email; |
||
79 | |||
80 | /** |
||
81 | * @var string |
||
82 | * @Assert\NotBlank() |
||
83 | * @Assert\Type("string") |
||
84 | * @Assert\Length( |
||
85 | * max = 255 |
||
86 | * ) |
||
87 | * @ORM\Column(type="string", length=255) |
||
88 | */ |
||
89 | private $password; |
||
90 | |||
91 | /** |
||
92 | * @var string |
||
93 | */ |
||
94 | private $plainPassword; |
||
95 | |||
96 | /** |
||
97 | * @ORM\Column(type="boolean") |
||
98 | */ |
||
99 | private $isActive = true; |
||
100 | |||
101 | /** |
||
102 | * @var |
||
103 | * @ORM\Column(type="json_array") |
||
104 | */ |
||
105 | protected $roles; |
||
106 | |||
107 | /** |
||
108 | * @var string |
||
109 | * |
||
110 | * @ORM\Column(type="string", unique=true, nullable=true) |
||
111 | */ |
||
112 | private $apiToken; |
||
113 | |||
114 | /** |
||
115 | * @var ArrayCollection[Event] |
||
116 | * @ORM\ManyToMany(targetEntity="Event", inversedBy="users") |
||
117 | */ |
||
118 | private $events; |
||
119 | |||
120 | /** |
||
121 | * @var ArrayCollection[FormRequest] |
||
122 | * @ORM\OneToMany(targetEntity="FormRequest", mappedBy="user") |
||
123 | */ |
||
124 | private $formRequests; |
||
125 | |||
126 | /** |
||
127 | * @var ArrayCollection[Survey] |
||
128 | * @ORM\OneToMany(targetEntity="Survey", mappedBy="user") |
||
129 | */ |
||
130 | private $surveys; |
||
131 | |||
132 | public function __construct() |
||
139 | |||
140 | /** |
||
141 | * Get id. |
||
142 | * |
||
143 | * @return int |
||
144 | */ |
||
145 | public function getId() |
||
146 | { |
||
147 | return $this->id; |
||
148 | } |
||
149 | |||
150 | /** |
||
151 | * Get name. |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | 3 | public function getUsername() |
|
156 | { |
||
157 | 3 | return $this->email; |
|
158 | } |
||
159 | |||
160 | /** |
||
161 | * Set firstname. |
||
162 | * |
||
163 | * @param string $name |
||
164 | * |
||
165 | * @return User |
||
166 | */ |
||
167 | public function setFirstName($name) |
||
168 | { |
||
169 | $this->firstName = $name; |
||
170 | |||
171 | return $this; |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * Get first name. |
||
176 | * |
||
177 | * @return string |
||
178 | */ |
||
179 | 3 | public function getFirstName() |
|
180 | { |
||
181 | 3 | return $this->firstName; |
|
182 | } |
||
183 | |||
184 | /** |
||
185 | * Set lastName. |
||
186 | * |
||
187 | * @param string $lastName |
||
188 | * |
||
189 | * @return User |
||
190 | */ |
||
191 | public function setLastName($lastName) |
||
192 | { |
||
193 | $this->lastName = $lastName; |
||
194 | |||
195 | return $this; |
||
196 | } |
||
197 | |||
198 | /** |
||
199 | * Get lastName. |
||
200 | * |
||
201 | * @return string |
||
202 | */ |
||
203 | 2 | public function getLastName() |
|
204 | { |
||
205 | 2 | return $this->lastName; |
|
206 | } |
||
207 | |||
208 | /** |
||
209 | * Set image. |
||
210 | * |
||
211 | * @param string $image |
||
212 | * |
||
213 | * @return User |
||
214 | */ |
||
215 | public function setImage($image) |
||
216 | { |
||
217 | $this->image = $image; |
||
218 | |||
219 | return $this; |
||
220 | } |
||
221 | |||
222 | /** |
||
223 | * Get image. |
||
224 | * |
||
225 | * @return string |
||
226 | */ |
||
227 | public function getImage() |
||
228 | { |
||
229 | return $this->image; |
||
230 | } |
||
231 | |||
232 | /** |
||
233 | * Set email. |
||
234 | * |
||
235 | * @param string $email |
||
236 | * |
||
237 | * @return User |
||
238 | */ |
||
239 | public function setEmail($email) |
||
240 | { |
||
241 | $this->email = $email; |
||
242 | |||
243 | return $this; |
||
244 | } |
||
245 | |||
246 | /** |
||
247 | * Get email. |
||
248 | * |
||
249 | * @return string |
||
250 | */ |
||
251 | public function getEmail() |
||
255 | |||
256 | /** |
||
257 | * Set password. |
||
258 | * |
||
259 | * @param string $password |
||
260 | * |
||
261 | * @return User |
||
262 | */ |
||
263 | public function setPassword($password) |
||
269 | |||
270 | /** |
||
271 | * Get password. |
||
272 | * |
||
273 | * @return string |
||
274 | */ |
||
275 | public function getPassword() |
||
279 | |||
280 | /** |
||
281 | * @return string |
||
282 | */ |
||
283 | public function getPlainPassword() |
||
284 | { |
||
285 | return $this->plainPassword; |
||
286 | } |
||
287 | |||
288 | /** |
||
289 | * @param string $plainPassword |
||
290 | */ |
||
291 | 3 | public function setPlainPassword($plainPassword) |
|
292 | { |
||
293 | 3 | $this->plainPassword = $plainPassword; |
|
294 | 3 | } |
|
295 | |||
296 | /** |
||
297 | * @param bool $status |
||
298 | * |
||
299 | * @return $this |
||
300 | */ |
||
301 | public function setIsEnabled($status) |
||
302 | { |
||
303 | $this->isActive = $status; |
||
304 | |||
305 | return $this; |
||
306 | } |
||
307 | |||
308 | /** |
||
309 | * @return bool |
||
310 | */ |
||
311 | 3 | public function isEnabled() |
|
312 | { |
||
313 | 3 | return $this->isActive; |
|
314 | } |
||
315 | |||
316 | /** |
||
317 | * @param mixed $roles |
||
318 | */ |
||
319 | public function setRoles($roles) |
||
320 | { |
||
321 | $this->roles = $roles; |
||
322 | } |
||
323 | |||
324 | /** |
||
325 | * @return mixed |
||
326 | */ |
||
327 | 3 | public function getRoles() |
|
328 | { |
||
329 | 3 | return $this->roles; |
|
330 | } |
||
331 | |||
332 | /** |
||
333 | * Set api token. |
||
334 | * |
||
335 | * @param string $apiToken |
||
336 | * |
||
337 | * @return User |
||
338 | */ |
||
339 | public function setApiToken($apiToken) |
||
340 | { |
||
341 | $this->apiToken = $apiToken; |
||
342 | |||
343 | return $this; |
||
344 | } |
||
345 | |||
346 | /** |
||
347 | * @return string |
||
348 | */ |
||
349 | public function getApiToken() |
||
350 | { |
||
351 | return $this->apiToken; |
||
352 | } |
||
353 | |||
354 | /** |
||
355 | * @param Event $event |
||
356 | * |
||
357 | * @return User |
||
358 | */ |
||
359 | public function setEvent($event) |
||
368 | |||
369 | /** |
||
370 | * @return ArrayCollection |
||
371 | */ |
||
372 | public function getEvents() |
||
376 | |||
377 | /** |
||
378 | * @return ArrayCollection |
||
379 | */ |
||
380 | public function getFormRequests() |
||
384 | |||
385 | /** |
||
386 | * @return ArrayCollection |
||
387 | */ |
||
388 | public function getSurveys() |
||
392 | |||
393 | 3 | public function isAccountNonExpired() |
|
394 | { |
||
395 | 3 | return true; |
|
396 | } |
||
397 | |||
398 | 3 | public function isAccountNonLocked() |
|
399 | { |
||
400 | 3 | return true; |
|
401 | } |
||
402 | |||
403 | 3 | public function isCredentialsNonExpired() |
|
404 | { |
||
405 | 3 | return true; |
|
406 | } |
||
407 | |||
408 | public function getSalt() |
||
412 | |||
413 | 3 | public function eraseCredentials() |
|
414 | { |
||
415 | 3 | $this->setPlainPassword(null); |
|
416 | 3 | } |
|
417 | |||
418 | /** @see \Serializable::serialize() */ |
||
419 | public function serialize() |
||
429 | |||
430 | /** @see \Serializable::unserialize() */ |
||
431 | public function unserialize($serialized) |
||
440 | } |
||
441 |