1 | <?php |
||
21 | class User implements UserInterface, \Serializable |
||
22 | { |
||
23 | const ROLE_USER = 'ROLE_USER'; |
||
24 | const ROLE_ADMIN = 'ROLE_ADMIN'; |
||
25 | |||
26 | /** |
||
27 | * @ORM\Id() |
||
28 | * @ORM\GeneratedValue() |
||
29 | * @ORM\Column(type="integer") |
||
30 | */ |
||
31 | private $id; |
||
32 | |||
33 | #private $tokens; |
||
34 | |||
35 | /** |
||
36 | * @var $profile UserProfile |
||
37 | * @ORM\OneToOne(targetEntity="App\Users\Entity\UserProfile", cascade={"persist", "remove"}) |
||
38 | */ |
||
39 | private $profile; |
||
40 | |||
41 | /** |
||
42 | * @ORM\Column(type="string", length=255, unique=true) |
||
43 | */ |
||
44 | public $email; |
||
45 | |||
46 | /** |
||
47 | * @ORM\Column(type="integer", length=1, options={"default" : 0}) |
||
48 | */ |
||
49 | private $isEmailConfirmed = 0; |
||
50 | |||
51 | /** |
||
52 | * @ORM\Column(type="string", length=255, unique=true) |
||
53 | */ |
||
54 | public $username; |
||
55 | |||
56 | /** |
||
57 | * @ORM\Column(type="string", length=255, nullable=true) |
||
58 | */ |
||
59 | private $roles; |
||
60 | |||
61 | /** |
||
62 | * @Exclude |
||
63 | */ |
||
64 | private $plainPassword; |
||
65 | |||
66 | /** |
||
67 | * @Exclude |
||
68 | * @ORM\Column(type="string", length=64) |
||
69 | */ |
||
70 | private $password; |
||
71 | |||
72 | 31 | public function __construct() |
|
77 | |||
78 | 8 | public function getProfile(): UserProfile |
|
82 | |||
83 | 4 | public function getId(): ?int |
|
87 | |||
88 | 31 | public function addRole(string $role): self |
|
98 | |||
99 | 1 | public function removeRole(string $role): self |
|
111 | |||
112 | 3 | private function setRoles(array $roles): self |
|
123 | |||
124 | 35 | public function getRoles(): array |
|
138 | |||
139 | 33 | private function getDefaultRoles() |
|
143 | |||
144 | 5 | public function setPlainPassword(string $plainPassword): self |
|
154 | |||
155 | 7 | public function getPlainPassword(): string |
|
159 | |||
160 | 9 | public function setPassword($password, UserPasswordEncoderInterface $passwordEncoder): self |
|
166 | |||
167 | 6 | public function isPasswordValid($password, UserPasswordEncoderInterface $passwordEncoder): bool |
|
171 | |||
172 | 4 | public function getPassword(): ?string |
|
176 | |||
177 | 11 | public function getSalt(): ?string |
|
181 | |||
182 | 7 | public function getUsername(): ?string |
|
186 | |||
187 | 10 | public function eraseCredentials(): self |
|
193 | |||
194 | 1 | public function serialize(): string |
|
203 | |||
204 | 1 | public function unserialize($serialized): self |
|
215 | |||
216 | 1 | public function confirmEmail() |
|
222 | |||
223 | public function changeEmail($email) |
||
230 | } |