2022-04-27 14:24:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Entity;
|
|
|
|
|
|
|
|
use App\Repository\UserRepository;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
use Symfony\Component\Security\Core\User\UserInterface;
|
|
|
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
|
|
|
|
|
|
|
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
|
|
|
class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var int|null
|
|
|
|
*/
|
|
|
|
#[ORM\Id()]
|
|
|
|
#[ORM\GeneratedValue(strategy: "AUTO")]
|
|
|
|
#[ORM\Column(type: "integer")]
|
|
|
|
private ?int $id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
#[ORM\Column(type: "string", length: 100)]
|
|
|
|
private string $email;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
#[ORM\Column(type: "string", length: 60)]
|
|
|
|
private string $password;
|
|
|
|
|
2022-09-07 14:36:22 +02:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
#[ORM\Column(type: "string", length: 15)]
|
|
|
|
private string $locale;
|
|
|
|
|
2022-04-27 14:24:48 +02:00
|
|
|
/**
|
|
|
|
* @return int|null
|
|
|
|
*/
|
|
|
|
public function getId(): ?int
|
|
|
|
{
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param int|null $id
|
|
|
|
* @return User
|
|
|
|
*/
|
|
|
|
public function setId(?int $id): User
|
|
|
|
{
|
|
|
|
$this->id = $id;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getEmail(): string
|
|
|
|
{
|
|
|
|
return $this->email;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $email
|
|
|
|
* @return User
|
|
|
|
*/
|
|
|
|
public function setEmail(string $email): User
|
|
|
|
{
|
|
|
|
$this->email = $email;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getPassword(): string
|
|
|
|
{
|
|
|
|
return $this->password;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $password
|
|
|
|
* @return User
|
|
|
|
*/
|
|
|
|
public function setPassword(string $password): User
|
|
|
|
{
|
|
|
|
$this->password = $password;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2022-09-07 14:36:22 +02:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getLocale(): string
|
|
|
|
{
|
|
|
|
return $this->locale;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $locale
|
|
|
|
* @return User
|
|
|
|
*/
|
|
|
|
public function setLocale(string $locale): User
|
|
|
|
{
|
|
|
|
$this->locale = $locale;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2022-04-27 14:24:48 +02:00
|
|
|
public function getRoles(): array
|
|
|
|
{
|
|
|
|
return array_unique(['ROLE_USER']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function eraseCredentials()
|
|
|
|
{
|
|
|
|
// TODO: Implement eraseCredentials() method.
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getUserIdentifier(): string
|
|
|
|
{
|
|
|
|
return (string) $this->email;
|
|
|
|
}
|
|
|
|
}
|