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\User |
17
|
|
|
* |
18
|
|
|
* @ORM\Entity |
19
|
|
|
* @ORM\Table(name="fos_user") |
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="salt", type="string", length=255) |
32
|
|
|
*/ |
33
|
|
|
protected $salt = 'mshop'; |
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=255) |
67
|
|
|
*/ |
68
|
|
|
protected $address1 = ''; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @ORM\Column(name="address2", type="string", length=255) |
72
|
|
|
*/ |
73
|
|
|
protected $address2 = ''; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @ORM\Column(name="address3", type="string", length=255) |
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=255) |
87
|
|
|
*/ |
88
|
|
|
protected $city = ''; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @ORM\Column(name="state", type="string", length=255) |
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) |
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=255) |
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="birthday", type="date", nullable=true) |
122
|
|
|
*/ |
123
|
|
|
protected $birthday; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @ORM\Column(name="vdate", type="date", nullable=true) |
127
|
|
|
*/ |
128
|
|
|
protected $vdate; |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @ORM\Column(name="ctime", type="datetime") |
132
|
|
|
*/ |
133
|
|
|
protected $ctime; |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @ORM\Column(name="mtime", type="datetime") |
137
|
|
|
*/ |
138
|
|
|
protected $mtime; |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @ORM\Column(name="editor", type="string", length=255) |
142
|
|
|
*/ |
143
|
|
|
protected $editor = ''; |
144
|
|
|
|
145
|
|
|
|
146
|
|
|
public function __construct() |
147
|
|
|
{ |
148
|
|
|
parent::__construct(); |
149
|
|
|
|
150
|
|
|
$this->ctime = new \DateTime(); |
151
|
|
|
$this->mtime = new \DateTime(); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* Returns the user unique id. |
157
|
|
|
* |
158
|
|
|
* @return mixed |
159
|
|
|
*/ |
160
|
|
|
public function getId() |
161
|
|
|
{ |
162
|
|
|
return $this->id; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @inheritDoc |
168
|
|
|
*/ |
169
|
|
|
public function getSalt() |
170
|
|
|
{ |
171
|
|
|
return $this->salt; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* Returns the company name. |
177
|
|
|
* |
178
|
|
|
* @return string Company name |
179
|
|
|
*/ |
180
|
|
|
public function getCompany() |
181
|
|
|
{ |
182
|
|
|
return $this->company; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Sets a new company name. |
188
|
|
|
* |
189
|
|
|
* @param string $company New company name |
190
|
|
|
*/ |
191
|
|
|
public function setCompany($company) |
192
|
|
|
{ |
193
|
|
|
$this->company = (string) $company; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* Returns the vatid. |
199
|
|
|
* |
200
|
|
|
* @return string vatid |
201
|
|
|
*/ |
202
|
|
|
public function getVatID() |
203
|
|
|
{ |
204
|
|
|
return $this->vatid; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* Sets a new vatid. |
210
|
|
|
* |
211
|
|
|
* @param string $vatid New vatid |
212
|
|
|
*/ |
213
|
|
|
public function setVatID($vatid) |
214
|
|
|
{ |
215
|
|
|
$this->vatid = (string) $vatid; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* Returns the salutation constant for the person described by the address. |
221
|
|
|
* |
222
|
|
|
* @return string Saluatation constant defined in \Aimeos\MShop\Common\Item\Address\Base |
223
|
|
|
*/ |
224
|
|
|
public function getSalutation() |
225
|
|
|
{ |
226
|
|
|
return ( isset( $this->salutation ) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN ); |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* Sets the new salutation for the person described by the address. |
232
|
|
|
* |
233
|
|
|
* @param string $salutation Salutation constant defined in \Aimeos\MShop\Common\Item\Address\Base |
234
|
|
|
*/ |
235
|
|
|
public function setSalutation($salutation) |
236
|
|
|
{ |
237
|
|
|
switch( $salutation ) |
238
|
|
|
{ |
239
|
|
|
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN: |
240
|
|
|
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY: |
241
|
|
|
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MRS: |
242
|
|
|
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MISS: |
243
|
|
|
case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR: |
244
|
|
|
break; |
245
|
|
|
default: |
246
|
|
|
throw new \Exception( sprintf( 'Address salutation "%1$s" is unknown', $value ) ); |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
$this->salutation = (string) $salutation; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* Returns the title of the person. |
255
|
|
|
* |
256
|
|
|
* @return string Title of the person |
257
|
|
|
*/ |
258
|
|
|
public function getTitle() |
259
|
|
|
{ |
260
|
|
|
return $this->title; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* Sets a new title of the person. |
266
|
|
|
* |
267
|
|
|
* @param string $title New title of the person |
268
|
|
|
*/ |
269
|
|
|
public function setTitle($title) |
270
|
|
|
{ |
271
|
|
|
$this->title = (string) $title; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Returns the first name of the person. |
277
|
|
|
* |
278
|
|
|
* @return string First name of the person |
279
|
|
|
*/ |
280
|
|
|
public function getFirstname() |
281
|
|
|
{ |
282
|
|
|
return $this->firstname; |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* Sets a new first name of the person. |
288
|
|
|
* |
289
|
|
|
* @param string $firstname New first name of the person |
290
|
|
|
*/ |
291
|
|
|
public function setFirstname($firstname) |
292
|
|
|
{ |
293
|
|
|
$this->firstname = (string) $firstname; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* Returns the last name of the person. |
299
|
|
|
* |
300
|
|
|
* @return string Last name of the person |
301
|
|
|
*/ |
302
|
|
|
public function getLastname() |
303
|
|
|
{ |
304
|
|
|
return $this->lastname; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* Sets a new last name of the person. |
310
|
|
|
* |
311
|
|
|
* @param string $lastname New last name of the person |
312
|
|
|
*/ |
313
|
|
|
public function setLastname($lastname) |
314
|
|
|
{ |
315
|
|
|
$this->lastname = (string) $lastname; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
|
319
|
|
|
/** |
320
|
|
|
* Returns the first address part, e.g. the street name. |
321
|
|
|
* |
322
|
|
|
* @return string First address part |
323
|
|
|
*/ |
324
|
|
|
public function getAddress1() |
325
|
|
|
{ |
326
|
|
|
return $this->address1; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* Sets a new first address part, e.g. the street name. |
332
|
|
|
* |
333
|
|
|
* @param string $address1 New first address part |
334
|
|
|
*/ |
335
|
|
|
public function setAddress1($address1) |
336
|
|
|
{ |
337
|
|
|
$this->address1 = (string) $address1; |
338
|
|
|
} |
339
|
|
|
|
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* Returns the second address part, e.g. the house number. |
343
|
|
|
* |
344
|
|
|
* @return string Second address part |
345
|
|
|
*/ |
346
|
|
|
public function getAddress2() |
347
|
|
|
{ |
348
|
|
|
return $this->address2; |
349
|
|
|
} |
350
|
|
|
|
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* Sets a new second address part, e.g. the house number. |
354
|
|
|
* |
355
|
|
|
* @param string $address2 New second address part |
356
|
|
|
*/ |
357
|
|
|
public function setAddress2($address2) |
358
|
|
|
{ |
359
|
|
|
$this->address2 = (string) $address2; |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* Returns the third address part, e.g. the house name or floor number. |
365
|
|
|
* |
366
|
|
|
* @return string third address part |
367
|
|
|
*/ |
368
|
|
|
public function getAddress3() |
369
|
|
|
{ |
370
|
|
|
return $this->address3; |
371
|
|
|
} |
372
|
|
|
|
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* Sets a new third address part, e.g. the house name or floor number. |
376
|
|
|
* |
377
|
|
|
* @param string $address3 New third address part |
378
|
|
|
*/ |
379
|
|
|
public function setAddress3($address3) |
380
|
|
|
{ |
381
|
|
|
$this->address3 = (string) $address3; |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
|
385
|
|
|
/** |
386
|
|
|
* Returns the postal code. |
387
|
|
|
* |
388
|
|
|
* @return string Postal code |
389
|
|
|
*/ |
390
|
|
|
public function getPostal() |
391
|
|
|
{ |
392
|
|
|
return $this->postal; |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
|
396
|
|
|
/** |
397
|
|
|
* Sets a new postal code. |
398
|
|
|
* |
399
|
|
|
* @param string $postal New postal code |
400
|
|
|
*/ |
401
|
|
|
public function setPostal($postal) |
402
|
|
|
{ |
403
|
|
|
$this->postal = (string) $postal; |
404
|
|
|
} |
405
|
|
|
|
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* Returns the city name. |
409
|
|
|
* |
410
|
|
|
* @return string City name |
411
|
|
|
*/ |
412
|
|
|
public function getCity() |
413
|
|
|
{ |
414
|
|
|
return $this->city; |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
|
418
|
|
|
/** |
419
|
|
|
* Sets a new city name. |
420
|
|
|
* |
421
|
|
|
* @param string $city New city name |
422
|
|
|
*/ |
423
|
|
|
public function setCity($city) |
424
|
|
|
{ |
425
|
|
|
$this->city = (string) $city; |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
|
429
|
|
|
/** |
430
|
|
|
* Returns the state name. |
431
|
|
|
* |
432
|
|
|
* @return string State name |
433
|
|
|
*/ |
434
|
|
|
public function getState() |
435
|
|
|
{ |
436
|
|
|
return $this->state; |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
|
440
|
|
|
/** |
441
|
|
|
* Sets a new state name. |
442
|
|
|
* |
443
|
|
|
* @param string $state New state name |
444
|
|
|
*/ |
445
|
|
|
public function setState($state) |
446
|
|
|
{ |
447
|
|
|
$this->state = (string) $state; |
448
|
|
|
} |
449
|
|
|
|
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* Sets the ID of the country the address is in. |
453
|
|
|
* |
454
|
|
|
* @param string $countryid Unique ID of the country |
455
|
|
|
*/ |
456
|
|
|
public function setCountryId($countryid) |
457
|
|
|
{ |
458
|
|
|
$this->countryid = strtoupper( (string) $countryid ); |
459
|
|
|
} |
460
|
|
|
|
461
|
|
|
|
462
|
|
|
/** |
463
|
|
|
* Returns the unique ID of the country the address belongs to. |
464
|
|
|
* |
465
|
|
|
* @return string Unique ID of the country |
466
|
|
|
*/ |
467
|
|
|
public function getCountryId() |
468
|
|
|
{ |
469
|
|
|
return $this->countryid; |
470
|
|
|
} |
471
|
|
|
|
472
|
|
|
|
473
|
|
|
/** |
474
|
|
|
* Sets the ID of the language. |
475
|
|
|
* |
476
|
|
|
* @param string $langid Unique ID of the language |
477
|
|
|
*/ |
478
|
|
|
public function setLanguageId($langid) |
479
|
|
|
{ |
480
|
|
|
$this->langid = strtolower( (string) $langid ); |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
|
484
|
|
|
/** |
485
|
|
|
* Returns the unique ID of the language. |
486
|
|
|
* |
487
|
|
|
* @return string Unique ID of the language |
488
|
|
|
*/ |
489
|
|
|
public function getLanguageId() |
490
|
|
|
{ |
491
|
|
|
return $this->langid; |
492
|
|
|
} |
493
|
|
|
|
494
|
|
|
|
495
|
|
|
/** |
496
|
|
|
* Returns the telephone number. |
497
|
|
|
* |
498
|
|
|
* @return string Telephone number |
499
|
|
|
*/ |
500
|
|
|
public function getTelephone() |
501
|
|
|
{ |
502
|
|
|
return $this->telephone; |
503
|
|
|
} |
504
|
|
|
|
505
|
|
|
|
506
|
|
|
/** |
507
|
|
|
* Sets a new telephone number. |
508
|
|
|
* |
509
|
|
|
* @param string $telephone New telephone number |
510
|
|
|
*/ |
511
|
|
|
public function setTelephone($telephone) |
512
|
|
|
{ |
513
|
|
|
$this->telephone = (string) $telephone; |
514
|
|
|
} |
515
|
|
|
|
516
|
|
|
|
517
|
|
|
/** |
518
|
|
|
* Returns the telefax number. |
519
|
|
|
* |
520
|
|
|
* @return string Telefax number |
521
|
|
|
*/ |
522
|
|
|
public function getTelefax() |
523
|
|
|
{ |
524
|
|
|
return $this->telefax; |
525
|
|
|
} |
526
|
|
|
|
527
|
|
|
|
528
|
|
|
/** |
529
|
|
|
* Sets a new telefax number. |
530
|
|
|
* |
531
|
|
|
* @param string $telefax New telefax number |
532
|
|
|
*/ |
533
|
|
|
public function setTelefax($telefax) |
534
|
|
|
{ |
535
|
|
|
$this->telefax = (string) $telefax; |
536
|
|
|
} |
537
|
|
|
|
538
|
|
|
|
539
|
|
|
/** |
540
|
|
|
* Returns the website URL. |
541
|
|
|
* |
542
|
|
|
* @return string Website URL |
543
|
|
|
*/ |
544
|
|
|
public function getWebsite() |
545
|
|
|
{ |
546
|
|
|
return $this->website; |
547
|
|
|
} |
548
|
|
|
|
549
|
|
|
|
550
|
|
|
/** |
551
|
|
|
* Sets a new website URL. |
552
|
|
|
* |
553
|
|
|
* @param string $website New website URL |
554
|
|
|
*/ |
555
|
|
|
public function setWebsite($website) |
556
|
|
|
{ |
557
|
|
|
$pattern = '#^([a-z]+://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?(/.*)?$#'; |
558
|
|
|
|
559
|
|
|
if( $website !== '' && preg_match( $pattern, $website ) !== 1 ) { |
560
|
|
|
throw new \Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) ); |
561
|
|
|
} |
562
|
|
|
|
563
|
|
|
$this->website = (string) $website; |
564
|
|
|
} |
565
|
|
|
} |
566
|
|
|
|