1 | <?php |
||
20 | class User implements UserInterface, \Serializable |
||
21 | { |
||
22 | use EntityIdTrait; |
||
23 | /** |
||
24 | * Requests older than this many seconds will be considered expired. |
||
25 | */ |
||
26 | public const RETRY_TTL = 3600; |
||
27 | /** |
||
28 | * Maximum time that the confirmation token will be valid. |
||
29 | */ |
||
30 | public const TOKEN_TTL = 43200; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | * |
||
35 | * @ORM\Column(type="string") |
||
36 | * @Assert\NotBlank() |
||
37 | */ |
||
38 | private $fullName; |
||
39 | /** |
||
40 | * @var string |
||
41 | * |
||
42 | * @ORM\Column(type="string", unique=true) |
||
43 | * @Assert\NotBlank() |
||
44 | * @Assert\Length(min=2, max=50) |
||
45 | */ |
||
46 | private $username; |
||
47 | /** |
||
48 | * @var string |
||
49 | * |
||
50 | * @ORM\Column(type="string") |
||
51 | * @Assert\NotBlank() |
||
52 | */ |
||
53 | private $phone; |
||
54 | /** |
||
55 | * @var string |
||
56 | * |
||
57 | * @ORM\Column(type="string", unique=true) |
||
58 | * @Assert\Email() |
||
59 | */ |
||
60 | private $email; |
||
61 | /** |
||
62 | * @var string |
||
63 | * |
||
64 | * @ORM\Column(type="string") |
||
65 | */ |
||
66 | private $password; |
||
67 | /** |
||
68 | * @var array |
||
69 | * |
||
70 | * @ORM\Column(type="json") |
||
71 | */ |
||
72 | private $roles = []; |
||
73 | |||
74 | /** |
||
75 | * @ORM\OneToMany(targetEntity="App\Entity\Property", mappedBy="author") |
||
76 | */ |
||
77 | private $properties; |
||
78 | |||
79 | /** |
||
80 | * @ORM\Column(type="string", length=255, nullable=true) |
||
81 | */ |
||
82 | private $confirmation_token; |
||
83 | |||
84 | /** |
||
85 | * @ORM\Column(type="datetime", nullable=true) |
||
86 | */ |
||
87 | private $password_requested_at; |
||
88 | |||
89 | public function __construct() |
||
93 | |||
94 | public function setFullName(string $fullName): void |
||
98 | |||
99 | public function getFullName(): ?string |
||
103 | |||
104 | public function getUsername(): ?string |
||
108 | |||
109 | public function setUsername(string $username): void |
||
113 | |||
114 | public function getPhone(): ?string |
||
118 | |||
119 | public function setPhone(string $phone): void |
||
123 | |||
124 | public function getEmail(): ?string |
||
128 | |||
129 | public function setEmail(string $email): void |
||
133 | |||
134 | public function getPassword(): ?string |
||
138 | |||
139 | public function setPassword(string $password): void |
||
143 | |||
144 | /** |
||
145 | * Returns the roles or permissions granted to the user for security. |
||
146 | */ |
||
147 | public function getRoles(): array |
||
157 | |||
158 | public function setRoles(array $roles): void |
||
159 | { |
||
160 | $this->roles = $roles; |
||
161 | } |
||
162 | |||
163 | /** |
||
164 | * Returns the salt that was originally used to encode the password. |
||
165 | * |
||
166 | * {@inheritdoc} |
||
167 | */ |
||
168 | public function getSalt(): ?string |
||
175 | |||
176 | /** |
||
177 | * Removes sensitive data from the user. |
||
178 | * |
||
179 | * {@inheritdoc} |
||
180 | */ |
||
181 | public function eraseCredentials(): void |
||
186 | |||
187 | /** |
||
188 | * {@inheritdoc} |
||
189 | */ |
||
190 | public function serialize(): string |
||
195 | |||
196 | /** |
||
197 | * {@inheritdoc} |
||
198 | */ |
||
199 | public function unserialize($serialized): void |
||
204 | |||
205 | public function getProperties(): Collection |
||
209 | |||
210 | public function addProperty(Property $property): self |
||
219 | |||
220 | public function removeProperty(Property $property): self |
||
232 | |||
233 | public function getConfirmationToken(): ?string |
||
237 | |||
238 | public function setConfirmationToken(?string $confirmation_token): self |
||
244 | |||
245 | public function getPasswordRequestedAt(): ?\DateTimeInterface |
||
249 | |||
250 | public function setPasswordRequestedAt(?\DateTimeInterface $password_requested_at): self |
||
256 | |||
257 | /** |
||
258 | * Checks whether the password reset request has expired. |
||
259 | */ |
||
260 | public function isPasswordRequestNonExpired(int $ttl): bool |
||
265 | } |
||
266 |