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