Files
BookNest/src/Entity/User.php
2025-01-29 14:11:28 +01:00

133 lines
2.4 KiB
PHP

<?php
namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $email = null;
#[ORM\Column(length: 60)]
private ?string $pseudo = null;
#[ORM\Column(length: 255)]
private ?string $password = null;
#[ORM\Column(length: 255)]
private ?string $firstName = null;
#[ORM\Column(length: 255)]
private ?string $lastName = null;
#[ORM\Column(type: "json")]
private array $roles = [];
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): static
{
$this->email = $email;
return $this;
}
public function getPseudo(): ?string
{
return $this->pseudo;
}
public function setPseudo(string $pseudo): static
{
$this->pseudo = $pseudo;
return $this;
}
public function getPassword(): ?string
{
return $this->password;
}
public function setPassword(string $password): static
{
$this->password = $password;
return $this;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): static
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(string $lastName): static
{
$this->lastName = $lastName;
return $this;
}
public function getSalt(): ?string
{
return null;
}
public function getRoles(): array
{
$roles = $this->roles;
if (empty($roles)) {
$roles[] = 'ROLE_USER';
}
return $roles;
}
public function eraseCredentials(): void
{
}
public function getUserIdentifier(): string
{
return $this->email; // Ou $this->pseudo si tu préfères utiliser le pseudo
}
}