environnement complet autonome, révision complete de la méthode, ajout de configuration
This commit is contained in:
@ -2,25 +2,27 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Validator as AcmeAssert;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
class User
|
||||
class User implements UserInterface
|
||||
{
|
||||
private string $email;
|
||||
|
||||
/** @var array */
|
||||
protected $attributes;
|
||||
private string $login;
|
||||
private string $password;
|
||||
private string $rememberMe;
|
||||
private bool $rememberMe;
|
||||
|
||||
public function getEmail(): ?string
|
||||
public function __construct($login, $password, $attributes, $rememberMe = false)
|
||||
{
|
||||
return $this->email;
|
||||
$this->password = $password;
|
||||
$this->login = $login;
|
||||
$this->attributes = $attributes;
|
||||
$this->rememberMe = $rememberMe;
|
||||
}
|
||||
|
||||
public function setEmail(string $email): self
|
||||
public function getLogin(): ?string
|
||||
{
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
return $this->login;
|
||||
}
|
||||
|
||||
public function getPassword(): string
|
||||
@ -28,22 +30,37 @@ class User
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function setPassword(string $password): self
|
||||
public function getAttributes(): array
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
public function getRememberMe(): string
|
||||
public function getRememberMe(): bool
|
||||
{
|
||||
return $this->rememberMe;
|
||||
}
|
||||
|
||||
public function setRememberMe(bool $rememberMe): self
|
||||
public function getRoles(): array
|
||||
{
|
||||
$this->rememberMe = $rememberMe;
|
||||
|
||||
return $this;
|
||||
return ['ROLE_USER'];
|
||||
}
|
||||
}
|
||||
|
||||
public function getSalt(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function eraseCredentials()
|
||||
{
|
||||
}
|
||||
|
||||
public function getUsername(): string
|
||||
{
|
||||
return $this->login;
|
||||
}
|
||||
|
||||
public function getUserIdentifier(): string
|
||||
{
|
||||
return $this->login;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user