|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
// todo: supprimer ! (données qui reviendront via ReservationBundle) |
|
4
|
|
|
|
|
5
|
|
|
namespace PiedWeb\CMSBundle\Entity; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
8
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
9
|
|
|
|
|
10
|
|
|
trait UserExtendedTrait |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* @ORM\Column(type="string", length=50, nullable=true) |
|
14
|
|
|
* @Assert\Length( |
|
15
|
|
|
* min=2, |
|
16
|
|
|
* max=50, |
|
17
|
|
|
* minMessage="user.firstname.short", |
|
18
|
|
|
* maxMessage="user.firstname.long" |
|
19
|
|
|
* ) |
|
20
|
|
|
* @Assert\Regex( |
|
21
|
|
|
* pattern="/^[a-z\-0-9\s]+$/i", |
|
22
|
|
|
* message="user.firstname.invalid" |
|
23
|
|
|
* ) |
|
24
|
|
|
*/ |
|
25
|
|
|
private $firstname; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @ORM\Column(type="string", length=50, nullable=true) |
|
29
|
|
|
* @Assert\Length( |
|
30
|
|
|
* min=2, |
|
31
|
|
|
* max=50, |
|
32
|
|
|
* minMessage="user.name.short", |
|
33
|
|
|
* maxMessage="user.name.long" |
|
34
|
|
|
* ) |
|
35
|
|
|
* @Assert\Regex( |
|
36
|
|
|
* pattern="/^[a-z\-0-9\s]+$/i", |
|
37
|
|
|
* message="user.lastname.invalid" |
|
38
|
|
|
* ) |
|
39
|
|
|
*/ |
|
40
|
|
|
private $lastname; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @ORM\Column(type="string", length=100, nullable=true) |
|
44
|
|
|
* @Assert\Length( |
|
45
|
|
|
* min=2, |
|
46
|
|
|
* max=100, |
|
47
|
|
|
* minMessage="user.city.short", |
|
48
|
|
|
* maxMessage="user.city.long" |
|
49
|
|
|
* ) |
|
50
|
|
|
* @Assert\Regex( |
|
51
|
|
|
* pattern="/^[a-z\-0-9\s]+$/i", |
|
52
|
|
|
* message="user.city.invalid" |
|
53
|
|
|
* ) |
|
54
|
|
|
*/ |
|
55
|
|
|
private $city; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @ORM\Column(type="date", nullable=true) |
|
59
|
|
|
* @Assert\Date |
|
60
|
|
|
* @Assert\LessThan( |
|
61
|
|
|
* value="-1 years", |
|
62
|
|
|
* message="user.dateOfBirth.young" |
|
63
|
|
|
* ) |
|
64
|
|
|
*/ |
|
65
|
|
|
private $dateOfBirth; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @ORM\Column(type="string", length=64, nullable=true) |
|
69
|
|
|
* @Assert\Length( |
|
70
|
|
|
* min=2, |
|
71
|
|
|
* max=64, |
|
72
|
|
|
* minMessage="user.phone.short", |
|
73
|
|
|
* maxMessage="user.phone.long" |
|
74
|
|
|
* ) |
|
75
|
|
|
*/ |
|
76
|
|
|
private $phone; |
|
77
|
|
|
|
|
78
|
|
|
public function getFirstname(): ?string |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->firstname; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function setFirstname(?string $firstname): self |
|
84
|
|
|
{ |
|
85
|
|
|
$this->firstname = $firstname; |
|
86
|
|
|
|
|
87
|
|
|
return $this; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
public function getLastname(): ?string |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->lastname; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
public function setLastname(?string $lastname): self |
|
96
|
|
|
{ |
|
97
|
|
|
$this->lastname = $lastname; |
|
98
|
|
|
|
|
99
|
|
|
return $this; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
public function getCity(): ?string |
|
103
|
|
|
{ |
|
104
|
|
|
return $this->city; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
public function setCity(?string $city): self |
|
108
|
|
|
{ |
|
109
|
|
|
$this->city = $city; |
|
110
|
|
|
|
|
111
|
|
|
return $this; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
public function getDateOfBirth(): ?\DateTimeInterface |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->dateOfBirth; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
public function setDateOfBirth(?\DateTimeInterface $dateOfBirth): self |
|
120
|
|
|
{ |
|
121
|
|
|
$this->dateOfBirth = $dateOfBirth; |
|
122
|
|
|
|
|
123
|
|
|
return $this; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
public function getPhone(): ?string |
|
127
|
|
|
{ |
|
128
|
|
|
return $this->phone; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
public function setPhone(?string $phone): self |
|
132
|
|
|
{ |
|
133
|
|
|
$this->phone = $phone; |
|
134
|
|
|
|
|
135
|
|
|
return $this; |
|
136
|
|
|
} |
|
137
|
|
|
} |
|
138
|
|
|
|