|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) |
|
7
|
|
|
* @license MIT |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace Auth\Entity; |
|
11
|
|
|
|
|
12
|
|
|
use Core\Entity\AbstractEntity; |
|
13
|
|
|
use Core\Entity\EntityInterface; |
|
14
|
|
|
use Core\Entity\FileInterface; |
|
15
|
|
|
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* personal information of a user. |
|
19
|
|
|
* |
|
20
|
|
|
* @ODM\EmbeddedDocument |
|
21
|
|
|
*/ |
|
22
|
|
|
class Info extends AbstractEntity implements InfoInterface |
|
23
|
|
|
{ |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Day of birth of the user |
|
28
|
|
|
* |
|
29
|
|
|
* @var string |
|
30
|
|
|
* @ODM\Field("string") |
|
31
|
|
|
*/ |
|
32
|
|
|
protected $birthDay; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Month of birth of the user |
|
36
|
|
|
* |
|
37
|
|
|
* @var string |
|
38
|
|
|
* @ODM\Field(type="string") */ |
|
39
|
|
|
protected $birthMonth; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Year of birth of the user |
|
43
|
|
|
* |
|
44
|
|
|
* @var string |
|
45
|
|
|
* @ODM\Field(type="string") */ |
|
46
|
|
|
protected $birthYear; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* primary email of the user. |
|
50
|
|
|
* |
|
51
|
|
|
* @var string |
|
52
|
|
|
* @ODM\Field(type="string") */ |
|
53
|
|
|
protected $email; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Flag, if primary email is verified |
|
57
|
|
|
* |
|
58
|
|
|
* @var boolean |
|
59
|
|
|
* @ODM\Boolean |
|
60
|
|
|
*/ |
|
61
|
|
|
protected $emailVerified; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Firstname of the user |
|
65
|
|
|
* |
|
66
|
|
|
* @var string |
|
67
|
|
|
* @ODM\Field(type="string") */ |
|
68
|
|
|
protected $firstName; |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Gender of the user |
|
72
|
|
|
* |
|
73
|
|
|
* @var string |
|
74
|
|
|
* @ODM\Field(type="string") */ |
|
75
|
|
|
protected $gender; |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* house number of the users address |
|
79
|
|
|
* |
|
80
|
|
|
* @var string |
|
81
|
|
|
* @ODM\Field(type="string") */ |
|
82
|
|
|
protected $houseNumber; |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Lastname of the user |
|
86
|
|
|
* |
|
87
|
|
|
* @var string |
|
88
|
|
|
* @ODM\Field(type="string") */ |
|
89
|
|
|
protected $lastName; |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* phone number of the user |
|
93
|
|
|
* |
|
94
|
|
|
* @var string |
|
95
|
|
|
* @ODM\Field(type="string") */ |
|
96
|
|
|
protected $phone; |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* postal code of the users address |
|
100
|
|
|
* |
|
101
|
|
|
* @var string |
|
102
|
|
|
* @ODM\Field(type="string") */ |
|
103
|
|
|
protected $postalCode; |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* city of the users address |
|
107
|
|
|
* |
|
108
|
|
|
* @var string |
|
109
|
|
|
* @ODM\Field(type="string") */ |
|
110
|
|
|
protected $city; |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* the photo of an users profile |
|
114
|
|
|
* |
|
115
|
|
|
* @var FileInterface |
|
116
|
|
|
* @ODM\ReferenceOne(targetDocument="UserImage", simple=true, nullable=true, cascade={"all"}) |
|
117
|
|
|
*/ |
|
118
|
|
|
protected $image; |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* street of the users address |
|
122
|
|
|
* |
|
123
|
|
|
* @var string |
|
124
|
|
|
* @ODM\Field(type="string") */ |
|
125
|
|
|
protected $street; |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* country of the users address |
|
129
|
|
|
* |
|
130
|
|
|
* @var string |
|
131
|
|
|
* @ODM\Field(type="string") */ |
|
132
|
|
|
protected $country; |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* {@inheritdoc} |
|
136
|
|
|
* |
|
137
|
|
|
* @return $this |
|
138
|
|
|
*/ |
|
139
|
|
|
public function setBirthDay($birthDay) |
|
140
|
|
|
{ |
|
141
|
|
|
$this->birthDay=$birthDay; |
|
142
|
|
|
return $this; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* {@inheritdoc} |
|
147
|
|
|
* |
|
148
|
|
|
* @return string |
|
149
|
|
|
*/ |
|
150
|
|
|
public function getBirthDay() |
|
151
|
|
|
{ |
|
152
|
|
|
return $this->birthDay; |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* {@inheritdoc} |
|
157
|
|
|
* |
|
158
|
|
|
* @return $this |
|
159
|
|
|
*/ |
|
160
|
|
|
public function setBirthMonth($birthMonth) |
|
161
|
|
|
{ |
|
162
|
|
|
$this->birthMonth=$birthMonth; |
|
163
|
|
|
return $this; |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* {@inheritdoc} |
|
168
|
|
|
* |
|
169
|
|
|
* @return string |
|
170
|
|
|
*/ |
|
171
|
|
|
public function getBirthMonth() |
|
172
|
|
|
{ |
|
173
|
|
|
return $this->birthMonth; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* {@inheritdoc} |
|
178
|
|
|
* |
|
179
|
|
|
* @return $this |
|
180
|
|
|
*/ |
|
181
|
|
|
public function setBirthYear($birthYear) |
|
182
|
|
|
{ |
|
183
|
|
|
$this->birthYear=$birthYear; |
|
184
|
|
|
return $this; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
/** |
|
188
|
|
|
* {@inheritdoc} |
|
189
|
|
|
* |
|
190
|
|
|
* @return string |
|
191
|
|
|
*/ |
|
192
|
|
|
public function getBirthYear() |
|
193
|
|
|
{ |
|
194
|
|
|
return $this->birthYear; |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
/** |
|
198
|
|
|
* {@inheritdoc} |
|
199
|
|
|
* |
|
200
|
|
|
* @return $this |
|
201
|
|
|
*/ |
|
202
|
|
|
public function setEmail($email) |
|
203
|
|
|
{ |
|
204
|
|
|
$this->email = trim((String)$email); |
|
205
|
|
|
return $this; |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
/** |
|
209
|
|
|
* {@inheritdoc} |
|
210
|
|
|
* |
|
211
|
|
|
* @return string |
|
212
|
|
|
*/ |
|
213
|
|
|
public function getEmail() |
|
214
|
|
|
{ |
|
215
|
|
|
return $this->email; |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
/** |
|
219
|
|
|
* {@inheritdoc} |
|
220
|
|
|
* |
|
221
|
|
|
* @return bool |
|
222
|
|
|
*/ |
|
223
|
|
|
public function isEmailVerified() |
|
224
|
|
|
{ |
|
225
|
|
|
return $this->emailVerified; |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
/** |
|
229
|
|
|
* {@inheritdoc} |
|
230
|
|
|
* |
|
231
|
|
|
* @param bool $emailVerified |
|
232
|
|
|
* @return $this |
|
233
|
|
|
*/ |
|
234
|
|
|
public function setEmailVerified($emailVerified) |
|
235
|
|
|
{ |
|
236
|
|
|
$this->emailVerified = $emailVerified; |
|
237
|
|
|
return $this; |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
/** |
|
241
|
|
|
* {@inheritdoc} |
|
242
|
|
|
* |
|
243
|
|
|
* @return $this |
|
244
|
|
|
*/ |
|
245
|
|
|
public function setFirstName($firstName) |
|
246
|
|
|
{ |
|
247
|
|
|
$this->firstName = trim((String)$firstName); |
|
248
|
|
|
return $this; |
|
249
|
|
|
} |
|
250
|
|
|
|
|
251
|
|
|
|
|
252
|
|
|
/** |
|
253
|
|
|
* {@inheritdoc} |
|
254
|
|
|
* |
|
255
|
|
|
* @return string |
|
256
|
|
|
*/ |
|
257
|
|
|
public function getGender() |
|
258
|
|
|
{ |
|
259
|
|
|
return $this->gender; |
|
260
|
|
|
} |
|
261
|
|
|
|
|
262
|
|
|
/** |
|
263
|
|
|
* {@inheritdoc} |
|
264
|
|
|
* |
|
265
|
|
|
* @return $this |
|
266
|
|
|
*/ |
|
267
|
|
|
public function setGender($gender) |
|
268
|
|
|
{ |
|
269
|
|
|
$this->gender = trim((String)$gender); |
|
270
|
|
|
return $this; |
|
271
|
|
|
} |
|
272
|
|
|
|
|
273
|
|
|
/** |
|
274
|
|
|
* {@inheritdoc} |
|
275
|
|
|
* |
|
276
|
|
|
* @return string |
|
277
|
|
|
*/ |
|
278
|
|
|
public function getFirstName() |
|
279
|
|
|
{ |
|
280
|
|
|
return $this->firstName; |
|
281
|
|
|
} |
|
282
|
|
|
|
|
283
|
|
|
/** |
|
284
|
|
|
* {@inheritdoc} |
|
285
|
|
|
* |
|
286
|
|
|
* @return $this |
|
287
|
|
|
*/ |
|
288
|
|
|
public function setHouseNumber($houseNumber) |
|
289
|
|
|
{ |
|
290
|
|
|
$this->houseNumber=$houseNumber; |
|
291
|
|
|
return $this; |
|
292
|
|
|
} |
|
293
|
|
|
|
|
294
|
|
|
/** |
|
295
|
|
|
* {@inheritdoc} |
|
296
|
|
|
* |
|
297
|
|
|
* @return string |
|
298
|
|
|
*/ |
|
299
|
|
|
public function getHouseNumber() |
|
300
|
|
|
{ |
|
301
|
|
|
return $this->houseNumber; |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
/** |
|
305
|
|
|
* {@inheritdoc} |
|
306
|
|
|
* |
|
307
|
|
|
* @return $this |
|
308
|
|
|
*/ |
|
309
|
|
|
public function setLastName($name) |
|
310
|
|
|
{ |
|
311
|
|
|
$this->lastName = trim((String) $name); |
|
312
|
|
|
return $this; |
|
313
|
|
|
} |
|
314
|
|
|
|
|
315
|
|
|
/** |
|
316
|
|
|
* {@inheritdoc} |
|
317
|
|
|
* |
|
318
|
|
|
* @return string |
|
319
|
|
|
*/ |
|
320
|
|
|
public function getLastName() |
|
321
|
|
|
{ |
|
322
|
|
|
return $this->lastName; |
|
323
|
|
|
} |
|
324
|
|
|
|
|
325
|
|
|
/** |
|
326
|
|
|
* @param bool $emailIfEmpty |
|
327
|
|
|
* |
|
328
|
|
|
* @return string |
|
329
|
|
|
*/ |
|
330
|
|
|
public function getDisplayName($emailIfEmpty = true) |
|
331
|
|
|
{ |
|
332
|
|
|
if (!$this->lastName) { |
|
333
|
|
|
return $emailIfEmpty ? $this->email : ''; |
|
334
|
|
|
} |
|
335
|
|
|
return ($this->firstName ? $this->firstName . ' ' : '') . $this->lastName; |
|
336
|
|
|
} |
|
337
|
|
|
|
|
338
|
|
|
/** |
|
339
|
|
|
* {@inheritdoc} |
|
340
|
|
|
* |
|
341
|
|
|
* @return $this |
|
342
|
|
|
*/ |
|
343
|
|
|
public function setPhone($phone) |
|
344
|
|
|
{ |
|
345
|
|
|
$this->phone = (String) $phone; |
|
346
|
|
|
return $this; |
|
347
|
|
|
} |
|
348
|
|
|
|
|
349
|
|
|
/** |
|
350
|
|
|
* {@inheritdoc} |
|
351
|
|
|
* |
|
352
|
|
|
* @return string |
|
353
|
|
|
*/ |
|
354
|
|
|
public function getPhone() |
|
355
|
|
|
{ |
|
356
|
|
|
return $this->phone; |
|
357
|
|
|
} |
|
358
|
|
|
|
|
359
|
|
|
/** |
|
360
|
|
|
* {@inheritdoc} |
|
361
|
|
|
* |
|
362
|
|
|
* @return $this |
|
363
|
|
|
*/ |
|
364
|
|
|
public function setPostalCode($postalCode) |
|
365
|
|
|
{ |
|
366
|
|
|
$this->postalCode = (String) $postalCode; |
|
367
|
|
|
return $this; |
|
368
|
|
|
} |
|
369
|
|
|
|
|
370
|
|
|
/** |
|
371
|
|
|
* {@inheritdoc} |
|
372
|
|
|
* |
|
373
|
|
|
* @return string |
|
374
|
|
|
*/ |
|
375
|
|
|
public function getPostalCode() |
|
376
|
|
|
{ |
|
377
|
|
|
return $this->postalCode; |
|
378
|
|
|
} |
|
379
|
|
|
|
|
380
|
|
|
/** |
|
381
|
|
|
* {@inheritdoc} |
|
382
|
|
|
* |
|
383
|
|
|
* @return $this |
|
384
|
|
|
*/ |
|
385
|
|
|
public function setCity($city) |
|
386
|
|
|
{ |
|
387
|
|
|
$this->city = (String) $city; |
|
388
|
|
|
return $this; |
|
389
|
|
|
} |
|
390
|
|
|
|
|
391
|
|
|
/** |
|
392
|
|
|
* {@inheritdoc} |
|
393
|
|
|
* |
|
394
|
|
|
* @return string |
|
395
|
|
|
*/ |
|
396
|
|
|
public function getCity() |
|
397
|
|
|
{ |
|
398
|
|
|
return $this->city; |
|
399
|
|
|
} |
|
400
|
|
|
|
|
401
|
|
|
/** |
|
402
|
|
|
* {@inheritdoc} |
|
403
|
|
|
* |
|
404
|
|
|
* @param UserImage $image |
|
|
|
|
|
|
405
|
|
|
* @return $this |
|
406
|
|
|
*/ |
|
407
|
|
|
public function setImage(EntityInterface $image = null) |
|
408
|
|
|
{ |
|
409
|
|
|
$this->image = $image; |
|
|
|
|
|
|
410
|
|
|
return $this; |
|
411
|
|
|
} |
|
412
|
|
|
|
|
413
|
|
|
/** |
|
414
|
|
|
* {@inheritdoc} |
|
415
|
|
|
* |
|
416
|
|
|
* @return UserImage |
|
417
|
|
|
*/ |
|
418
|
|
|
public function getImage() |
|
419
|
|
|
{ |
|
420
|
|
|
return $this->image; |
|
421
|
|
|
} |
|
422
|
|
|
/** |
|
423
|
|
|
* {@inheritdoc} |
|
424
|
|
|
* |
|
425
|
|
|
* @return $this |
|
426
|
|
|
*/ |
|
427
|
|
|
public function setStreet($street) |
|
428
|
|
|
{ |
|
429
|
|
|
$this->street=$street; |
|
430
|
|
|
return $this; |
|
431
|
|
|
} |
|
432
|
|
|
|
|
433
|
|
|
/** |
|
434
|
|
|
* {@inheritdoc} |
|
435
|
|
|
* |
|
436
|
|
|
* @return string |
|
437
|
|
|
*/ |
|
438
|
|
|
public function getStreet() |
|
439
|
|
|
{ |
|
440
|
|
|
return $this->street; |
|
441
|
|
|
} |
|
442
|
|
|
|
|
443
|
|
|
/** |
|
444
|
|
|
* {@inheritdoc} |
|
445
|
|
|
* |
|
446
|
|
|
* @return $this |
|
447
|
|
|
*/ |
|
448
|
|
|
public function setCountry($country) |
|
449
|
|
|
{ |
|
450
|
|
|
$this->country=$country; |
|
451
|
|
|
return $this; |
|
452
|
|
|
} |
|
453
|
|
|
|
|
454
|
|
|
/** |
|
455
|
|
|
* {@inheritdoc} |
|
456
|
|
|
* |
|
457
|
|
|
* @return string |
|
458
|
|
|
*/ |
|
459
|
|
|
public function getCountry() |
|
460
|
|
|
{ |
|
461
|
|
|
return $this->country; |
|
462
|
|
|
} |
|
463
|
|
|
} |
|
464
|
|
|
|
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.