1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license MIT, http://opensource.org/licenses/MIT |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2015 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
namespace Aimeos\ShopBundle\Entity; |
10
|
|
|
|
11
|
|
|
use Doctrine\ORM\Mapping as ORM; |
12
|
|
|
use FOS\UserBundle\Model\User as BaseUser; |
13
|
|
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @ORM\Entity |
18
|
|
|
* @ORM\Table("fos_user") |
19
|
|
|
*/ |
20
|
|
|
class FosUser extends BaseUser implements PasswordAuthenticatedUserInterface |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @ORM\Id |
24
|
|
|
* @ORM\Column("id") |
25
|
|
|
*/ |
26
|
|
|
protected $id; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @ORM\Column("siteid") |
30
|
|
|
*/ |
31
|
|
|
protected $siteid; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @ORM\Column("salutation") |
35
|
|
|
*/ |
36
|
|
|
protected $salutation = ''; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @ORM\Column("company") |
40
|
|
|
*/ |
41
|
|
|
protected $company = ''; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @ORM\Column("vatid") |
45
|
|
|
*/ |
46
|
|
|
protected $vatid = ''; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @ORM\Column("title") |
50
|
|
|
*/ |
51
|
|
|
protected $title = ''; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @ORM\Column("firstname") |
55
|
|
|
*/ |
56
|
|
|
protected $firstname = ''; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @ORM\Column("lastname") |
60
|
|
|
*/ |
61
|
|
|
protected $lastname = ''; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @ORM\Column("address1") |
65
|
|
|
*/ |
66
|
|
|
protected $address1 = ''; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @ORM\Column("address2") |
70
|
|
|
*/ |
71
|
|
|
protected $address2 = ''; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @ORM\Column("address3") |
75
|
|
|
*/ |
76
|
|
|
protected $address3 = ''; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @ORM\Column("postal") |
80
|
|
|
*/ |
81
|
|
|
protected $postal = ''; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @ORM\Column("city") |
85
|
|
|
*/ |
86
|
|
|
protected $city = ''; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @ORM\Column("state") |
90
|
|
|
*/ |
91
|
|
|
protected $state = ''; |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @ORM\Column("langid") |
95
|
|
|
*/ |
96
|
|
|
protected $langid = null; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @ORM\Column("countryid") |
100
|
|
|
*/ |
101
|
|
|
protected $countryid = null; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @ORM\Column("telephone") |
105
|
|
|
*/ |
106
|
|
|
protected $telephone = ''; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @ORM\Column("telefax") |
110
|
|
|
*/ |
111
|
|
|
protected $telefax = ''; |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @ORM\Column("mobile") |
115
|
|
|
*/ |
116
|
|
|
protected $mobile = ''; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @ORM\Column("website") |
120
|
|
|
*/ |
121
|
|
|
protected $website = ''; |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @ORM\Column("longitude") |
125
|
|
|
*/ |
126
|
|
|
protected $longitude; |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @ORM\Column("latitude") |
130
|
|
|
*/ |
131
|
|
|
protected $latitude; |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @ORM\Column("birthday") |
135
|
|
|
*/ |
136
|
|
|
protected $birthday; |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @ORM\Column("vdate") |
140
|
|
|
*/ |
141
|
|
|
protected $vdate; |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @ORM\Column("ctime") |
145
|
|
|
*/ |
146
|
|
|
protected $ctime; |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @ORM\Column("mtime") |
150
|
|
|
*/ |
151
|
|
|
protected $mtime; |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @ORM\Column("editor") |
155
|
|
|
*/ |
156
|
|
|
protected $editor = ''; |
157
|
|
|
|
158
|
|
|
|
159
|
|
|
public function __construct() |
160
|
|
|
{ |
161
|
|
|
parent::__construct(); |
162
|
|
|
|
163
|
|
|
$this->ctime = new \DateTime(); |
164
|
|
|
$this->mtime = new \DateTime(); |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* Returns the user unique ID. |
170
|
|
|
* |
171
|
|
|
* @return string|null |
172
|
|
|
*/ |
173
|
|
|
public function getId() : ?string |
174
|
|
|
{ |
175
|
|
|
return $this->id; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* Returns the site ID of the user. |
181
|
|
|
* |
182
|
|
|
* @return mixed |
183
|
|
|
*/ |
184
|
|
|
public function getSiteId() : ?string |
185
|
|
|
{ |
186
|
|
|
return $this->siteid; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* Returns the company name. |
192
|
|
|
* |
193
|
|
|
* @return string Company name |
194
|
|
|
*/ |
195
|
|
|
public function getCompany() : string |
196
|
|
|
{ |
197
|
|
|
return (string) $this->company; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* Sets a new company name. |
203
|
|
|
* |
204
|
|
|
* @param string $company New company name |
205
|
|
|
*/ |
206
|
|
|
public function setCompany( string $company ) |
207
|
|
|
{ |
208
|
|
|
$this->company = (string) $company; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Returns the vatid. |
214
|
|
|
* |
215
|
|
|
* @return string vatid |
216
|
|
|
*/ |
217
|
|
|
public function getVatId() : string |
218
|
|
|
{ |
219
|
|
|
return (string) $this->vatid; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* Sets a new vatid. |
225
|
|
|
* |
226
|
|
|
* @param string $vatid New vatid |
227
|
|
|
*/ |
228
|
|
|
public function setVatID( string $vatid ) |
229
|
|
|
{ |
230
|
|
|
$this->vatid = (string) $vatid; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* Returns the salutation constant for the person described by the address. |
236
|
|
|
* |
237
|
|
|
* @return string Saluatation constant defined in \Aimeos\MShop\Common\Item\Address\Base |
238
|
|
|
*/ |
239
|
|
|
public function getSalutation() : string |
240
|
|
|
{ |
241
|
|
|
return $this->salutation ?? ''; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* Sets the new salutation for the person described by the address. |
247
|
|
|
* |
248
|
|
|
* @param string $salutation Salutation constant defined in \Aimeos\MShop\Common\Item\Address\Base |
249
|
|
|
*/ |
250
|
|
|
public function setSalutation( string $salutation ) |
251
|
|
|
{ |
252
|
|
|
$this->salutation = $salutation; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* Returns the title of the person. |
258
|
|
|
* |
259
|
|
|
* @return string Title of the person |
260
|
|
|
*/ |
261
|
|
|
public function getTitle() : string |
262
|
|
|
{ |
263
|
|
|
return (string) $this->title; |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* Sets a new title of the person. |
269
|
|
|
* |
270
|
|
|
* @param string $title New title of the person |
271
|
|
|
*/ |
272
|
|
|
public function setTitle( string $title ) |
273
|
|
|
{ |
274
|
|
|
$this->title = $title; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* Returns the first name of the person. |
280
|
|
|
* |
281
|
|
|
* @return string First name of the person |
282
|
|
|
*/ |
283
|
|
|
public function getFirstname() : string |
284
|
|
|
{ |
285
|
|
|
return (string) $this->firstname; |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* Sets a new first name of the person. |
291
|
|
|
* |
292
|
|
|
* @param string $firstname New first name of the person |
293
|
|
|
*/ |
294
|
|
|
public function setFirstname( string $firstname ) |
295
|
|
|
{ |
296
|
|
|
$this->firstname = $firstname; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
|
300
|
|
|
/** |
301
|
|
|
* Returns the last name of the person. |
302
|
|
|
* |
303
|
|
|
* @return string Last name of the person |
304
|
|
|
*/ |
305
|
|
|
public function getLastname() : string |
306
|
|
|
{ |
307
|
|
|
return (string) $this->lastname; |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
|
311
|
|
|
/** |
312
|
|
|
* Sets a new last name of the person. |
313
|
|
|
* |
314
|
|
|
* @param string $lastname New last name of the person |
315
|
|
|
*/ |
316
|
|
|
public function setLastname( string $lastname ) |
317
|
|
|
{ |
318
|
|
|
$this->lastname = $lastname; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* Returns the first address part, e.g. the street name. |
324
|
|
|
* |
325
|
|
|
* @return string First address part |
326
|
|
|
*/ |
327
|
|
|
public function getAddress1() : string |
328
|
|
|
{ |
329
|
|
|
return (string) $this->address1; |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* Sets a new first address part, e.g. the street name. |
335
|
|
|
* |
336
|
|
|
* @param string $address1 New first address part |
337
|
|
|
*/ |
338
|
|
|
public function setAddress1( string $address1 ) |
339
|
|
|
{ |
340
|
|
|
$this->address1 = $address1; |
341
|
|
|
} |
342
|
|
|
|
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* Returns the second address part, e.g. the house number. |
346
|
|
|
* |
347
|
|
|
* @return string Second address part |
348
|
|
|
*/ |
349
|
|
|
public function getAddress2() : string |
350
|
|
|
{ |
351
|
|
|
return (string) $this->address2; |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
|
355
|
|
|
/** |
356
|
|
|
* Sets a new second address part, e.g. the house number. |
357
|
|
|
* |
358
|
|
|
* @param string $address2 New second address part |
359
|
|
|
*/ |
360
|
|
|
public function setAddress2( string $address2 ) |
361
|
|
|
{ |
362
|
|
|
$this->address2 = $address2; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
|
366
|
|
|
/** |
367
|
|
|
* Returns the third address part, e.g. the house name or floor number. |
368
|
|
|
* |
369
|
|
|
* @return string third address part |
370
|
|
|
*/ |
371
|
|
|
public function getAddress3() : string |
372
|
|
|
{ |
373
|
|
|
return (string) $this->address3; |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
|
377
|
|
|
/** |
378
|
|
|
* Sets a new third address part, e.g. the house name or floor number. |
379
|
|
|
* |
380
|
|
|
* @param string $address3 New third address part |
381
|
|
|
*/ |
382
|
|
|
public function setAddress3( string $address3 ) |
383
|
|
|
{ |
384
|
|
|
$this->address3 = $address3; |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
|
388
|
|
|
/** |
389
|
|
|
* Returns the postal code. |
390
|
|
|
* |
391
|
|
|
* @return string Postal code |
392
|
|
|
*/ |
393
|
|
|
public function getPostal() : string |
394
|
|
|
{ |
395
|
|
|
return (string) $this->postal; |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* Sets a new postal code. |
401
|
|
|
* |
402
|
|
|
* @param string $postal New postal code |
403
|
|
|
*/ |
404
|
|
|
public function setPostal( string $postal ) |
405
|
|
|
{ |
406
|
|
|
$this->postal = $postal; |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
|
410
|
|
|
/** |
411
|
|
|
* Returns the city name. |
412
|
|
|
* |
413
|
|
|
* @return string City name |
414
|
|
|
*/ |
415
|
|
|
public function getCity() : string |
416
|
|
|
{ |
417
|
|
|
return (string) $this->city; |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
|
421
|
|
|
/** |
422
|
|
|
* Sets a new city name. |
423
|
|
|
* |
424
|
|
|
* @param string $city New city name |
425
|
|
|
*/ |
426
|
|
|
public function setCity( string $city ) |
427
|
|
|
{ |
428
|
|
|
$this->city = $city; |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
|
432
|
|
|
/** |
433
|
|
|
* Returns the state name. |
434
|
|
|
* |
435
|
|
|
* @return string State name |
436
|
|
|
*/ |
437
|
|
|
public function getState() : string |
438
|
|
|
{ |
439
|
|
|
return (string) $this->state; |
440
|
|
|
} |
441
|
|
|
|
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* Sets a new state name. |
445
|
|
|
* |
446
|
|
|
* @param string $state New state name |
447
|
|
|
*/ |
448
|
|
|
public function setState( string $state ) |
449
|
|
|
{ |
450
|
|
|
$this->state = $state; |
451
|
|
|
} |
452
|
|
|
|
453
|
|
|
|
454
|
|
|
/** |
455
|
|
|
* Returns the unique ID of the country the address belongs to. |
456
|
|
|
* |
457
|
|
|
* @return string Unique ID of the country |
458
|
|
|
*/ |
459
|
|
|
public function getCountryId() : string |
460
|
|
|
{ |
461
|
|
|
return (string) $this->countryid; |
462
|
|
|
} |
463
|
|
|
|
464
|
|
|
|
465
|
|
|
/** |
466
|
|
|
* Sets the ID of the country the address is in. |
467
|
|
|
* |
468
|
|
|
* @param string $countryid Unique ID of the country |
469
|
|
|
*/ |
470
|
|
|
public function setCountryId( string $countryid ) |
471
|
|
|
{ |
472
|
|
|
$this->countryid = strtoupper( $countryid ); |
473
|
|
|
} |
474
|
|
|
|
475
|
|
|
|
476
|
|
|
/** |
477
|
|
|
* Returns the unique ID of the language. |
478
|
|
|
* |
479
|
|
|
* @return string Unique ID of the language |
480
|
|
|
*/ |
481
|
|
|
public function getLanguageId() : string |
482
|
|
|
{ |
483
|
|
|
return (string) $this->langid; |
484
|
|
|
} |
485
|
|
|
|
486
|
|
|
|
487
|
|
|
/** |
488
|
|
|
* Sets the ID of the language. |
489
|
|
|
* |
490
|
|
|
* @param string $langid Unique ID of the language |
491
|
|
|
*/ |
492
|
|
|
public function setLanguageId( string $langid ) |
493
|
|
|
{ |
494
|
|
|
$this->langid = $langid; |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
|
498
|
|
|
/** |
499
|
|
|
* Returns the telephone number. |
500
|
|
|
* |
501
|
|
|
* @return string Telephone number |
502
|
|
|
*/ |
503
|
|
|
public function getTelephone() : string |
504
|
|
|
{ |
505
|
|
|
return (string) $this->telephone; |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
|
509
|
|
|
/** |
510
|
|
|
* Sets a new telephone number. |
511
|
|
|
* |
512
|
|
|
* @param string $telephone New telephone number |
513
|
|
|
*/ |
514
|
|
|
public function setTelephone( string $telephone ) |
515
|
|
|
{ |
516
|
|
|
$this->telephone = $telephone; |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
|
520
|
|
|
/** |
521
|
|
|
* Returns the telefax number. |
522
|
|
|
* |
523
|
|
|
* @return string Telefax number |
524
|
|
|
*/ |
525
|
|
|
public function getTelefax() : string |
526
|
|
|
{ |
527
|
|
|
return (string) $this->telefax; |
528
|
|
|
} |
529
|
|
|
|
530
|
|
|
|
531
|
|
|
/** |
532
|
|
|
* Sets a new telefax number. |
533
|
|
|
* |
534
|
|
|
* @param string $telefax New telefax number |
535
|
|
|
*/ |
536
|
|
|
public function setTelefax( string $telefax ) |
537
|
|
|
{ |
538
|
|
|
$this->telefax = $telefax; |
539
|
|
|
} |
540
|
|
|
|
541
|
|
|
|
542
|
|
|
/** |
543
|
|
|
* Returns the mobile number. |
544
|
|
|
* |
545
|
|
|
* @return string Mobile number |
546
|
|
|
*/ |
547
|
|
|
public function getMobile() : string |
548
|
|
|
{ |
549
|
|
|
return (string) $this->mobile; |
550
|
|
|
} |
551
|
|
|
|
552
|
|
|
|
553
|
|
|
/** |
554
|
|
|
* Sets a new mobile number. |
555
|
|
|
* |
556
|
|
|
* @param string $mobile New mobile number |
557
|
|
|
*/ |
558
|
|
|
public function setMobile( string $mobile ) |
559
|
|
|
{ |
560
|
|
|
$this->mobile = $mobile; |
561
|
|
|
} |
562
|
|
|
|
563
|
|
|
|
564
|
|
|
/** |
565
|
|
|
* Returns the website URL. |
566
|
|
|
* |
567
|
|
|
* @return string Website URL |
568
|
|
|
*/ |
569
|
|
|
public function getWebsite() : string |
570
|
|
|
{ |
571
|
|
|
return (string) $this->website; |
572
|
|
|
} |
573
|
|
|
|
574
|
|
|
|
575
|
|
|
/** |
576
|
|
|
* Sets a new website URL. |
577
|
|
|
* |
578
|
|
|
* @param string $website New website URL |
579
|
|
|
*/ |
580
|
|
|
public function setWebsite( string $website ) |
581
|
|
|
{ |
582
|
|
|
$pattern = '#^([a-z]+://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?(/.*)?$#'; |
583
|
|
|
|
584
|
|
|
if( $website !== '' && preg_match( $pattern, $website ) !== 1 ) { |
585
|
|
|
throw new \Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) ); |
586
|
|
|
} |
587
|
|
|
|
588
|
|
|
$this->website = $website; |
589
|
|
|
} |
590
|
|
|
|
591
|
|
|
|
592
|
|
|
/** |
593
|
|
|
* Returns the longitude. |
594
|
|
|
* |
595
|
|
|
* @return float Longitude value |
596
|
|
|
*/ |
597
|
|
|
public function getLongitude() : float |
598
|
|
|
{ |
599
|
|
|
return (float) $this->longitude; |
600
|
|
|
} |
601
|
|
|
|
602
|
|
|
|
603
|
|
|
/** |
604
|
|
|
* Sets a new longitude. |
605
|
|
|
* |
606
|
|
|
* @param float $value New longitude value |
607
|
|
|
*/ |
608
|
|
|
public function setLongitude( float $value ) |
609
|
|
|
{ |
610
|
|
|
$this->longitude = $value; |
611
|
|
|
} |
612
|
|
|
|
613
|
|
|
|
614
|
|
|
/** |
615
|
|
|
* Returns the latitude. |
616
|
|
|
* |
617
|
|
|
* @return float Latitude value |
618
|
|
|
*/ |
619
|
|
|
public function getLatitude() : float |
620
|
|
|
{ |
621
|
|
|
return (float) $this->latitude; |
622
|
|
|
} |
623
|
|
|
|
624
|
|
|
|
625
|
|
|
/** |
626
|
|
|
* Sets a new latitude. |
627
|
|
|
* |
628
|
|
|
* @param float $value New latitude value |
629
|
|
|
*/ |
630
|
|
|
public function setLatitude( float $value ) |
631
|
|
|
{ |
632
|
|
|
$this->latitude = $value; |
633
|
|
|
} |
634
|
|
|
} |
635
|
|
|
|