1 | <?php |
||
19 | class User implements UserInterface |
||
20 | { |
||
21 | /** |
||
22 | * @ORM\Id() |
||
23 | * @ORM\GeneratedValue() |
||
24 | * @ORM\Column(type="integer") |
||
25 | * @Groups({"list", "view"}) |
||
26 | */ |
||
27 | private $id; |
||
28 | |||
29 | /** |
||
30 | * @var UserProfile |
||
31 | * @ORM\OneToOne(targetEntity="App\Users\Entity\UserProfile", cascade={"persist", "remove"}) |
||
32 | * @Groups({"list", "view"}) |
||
33 | */ |
||
34 | private $profile; |
||
35 | |||
36 | /** |
||
37 | * @Groups({"ROLE_ADMIN", "ROLE_MODER"}) |
||
38 | * @ORM\Column(type="string", length=255, unique=true) |
||
39 | */ |
||
40 | private $email; |
||
41 | |||
42 | /** |
||
43 | * @Groups({"ROLE_ADMIN", "ROLE_MODER"}) |
||
44 | * @ORM\Column(type="integer", length=1, options={"default": 0}) |
||
45 | */ |
||
46 | private $isEmailConfirmed = 0; |
||
47 | |||
48 | /** |
||
49 | * @ORM\Column(type="string", length=255, unique=true) |
||
50 | * @Groups({"list", "view"}) |
||
51 | */ |
||
52 | private $username; |
||
53 | |||
54 | /** |
||
55 | * @Groups({"ROLE_ADMIN", "ROLE_MODER"}) |
||
56 | * @ORM\Embedded(class="App\Users\Entity\UserRoles", columnPrefix=false) |
||
57 | */ |
||
58 | private $roles; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | private $plainPassword; |
||
64 | |||
65 | /** |
||
66 | * @ORM\Column(type="string", length=64) |
||
67 | */ |
||
68 | private $password; |
||
69 | |||
70 | 32 | public function __construct(string $email, string $username, string $password) |
|
79 | |||
80 | 13 | public function getProfile(): UserProfile |
|
84 | |||
85 | 13 | public function getId(): ?int |
|
89 | |||
90 | 4 | public function getEmail(): string |
|
94 | |||
95 | public function isEmailConfirmed(): bool |
||
99 | |||
100 | 33 | public function setPlainPassword(string $plainPassword): self |
|
110 | |||
111 | 8 | public function getPlainPassword(): string |
|
115 | |||
116 | 10 | public function setPassword($password, UserPasswordEncoderInterface $passwordEncoder): self |
|
123 | |||
124 | /** |
||
125 | * @param $password |
||
126 | * @param UserPasswordEncoderInterface $passwordEncoder |
||
127 | * |
||
128 | * @return bool |
||
129 | */ |
||
130 | 1 | public function isPasswordValid($password, UserPasswordEncoderInterface $passwordEncoder): bool |
|
134 | |||
135 | 5 | public function getPassword(): ?string |
|
139 | |||
140 | 11 | public function getSalt(): ?string |
|
144 | |||
145 | 23 | public function getUsername(): ?string |
|
149 | |||
150 | 26 | public function eraseCredentials(): self |
|
156 | |||
157 | 1 | public function confirmEmail(): self |
|
163 | |||
164 | public function changeEmail($email): self |
||
171 | |||
172 | /** |
||
173 | * @return array |
||
174 | */ |
||
175 | 22 | public function getRoles() |
|
179 | |||
180 | 25 | public function getRolesObject(): UserRoles |
|
184 | } |
||
185 |