src/Entity/User.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  6. use Symfony\Component\Security\Core\User\UserInterface;
  7. #[ORM\Entity(repositoryClassUserRepository::class)]
  8. #[ORM\Table(name:'"user"')]
  9. class User implements UserInterfacePasswordAuthenticatedUserInterface
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue(strategy:"SEQUENCE")]
  13.     #[ORM\SequenceGenerator(sequenceName:'user_id_seq'initialValue:10)]
  14.     #[ORM\Column(type:"integer")]
  15.     private ?int $id null;
  16.     #[ORM\Column(length180uniquetrue)]
  17.     private ?string $username null;
  18.     #[ORM\Column(length180uniquetruenullabletrue)]
  19.     private ?string $mail null;
  20.     #[ORM\Column]
  21.     private array $roles = [];
  22.     /**
  23.      * @var string The hashed password
  24.      */
  25.     #[ORM\Column]
  26.     private ?string $password null;
  27.     public function getId(): ?int
  28.     {
  29.         return $this->id;
  30.     }
  31.     public function getUsername(): ?string
  32.     {
  33.         return $this->username;
  34.     }
  35.     public function setUsername(string $username): self
  36.     {
  37.         $this->username $username;
  38.         return $this;
  39.     }
  40.     public function getMail(): ?string
  41.     {
  42.         return $this->mail;
  43.     }
  44.     public function setMail(string $mail): self
  45.     {
  46.         $this->mail $mail;
  47.         return $this;
  48.     }
  49.     public function getEMail(): ?string
  50.     {
  51.         return $this->mail;
  52.     }
  53.     public function setEMail(string $mail): self
  54.     {
  55.         $this->mail $mail;
  56.         return $this;
  57.     }
  58.     /**
  59.      * A visual identifier that represents this user.
  60.      *
  61.      * @see UserInterface
  62.      */
  63.     public function getUserIdentifier(): string
  64.     {
  65.         return (string) $this->username;
  66.     }
  67.     /**
  68.      * @see UserInterface
  69.      */
  70.     public function getRoles(): array
  71.     {
  72.         $roles $this->roles;
  73.         // guarantee every user at least has ROLE_USER
  74.         $roles[] = 'ROLE_USER';
  75.         return array_unique($roles);
  76.     }
  77.     public function setRoles(array $roles): self
  78.     {
  79.         $this->roles $roles;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @see PasswordAuthenticatedUserInterface
  84.      */
  85.     public function getPassword(): string
  86.     {
  87.         return $this->password;
  88.     }
  89.     public function setPassword(string $password): self
  90.     {
  91.         $this->password $password;
  92.         return $this;
  93.     }
  94.     /**
  95.      * @see UserInterface
  96.      */
  97.     public function eraseCredentials()
  98.     {
  99.         // If you store any temporary, sensitive data on the user, clear it here
  100.         // $this->plainPassword = null;
  101.     }
  102. }