src/Entity/User.php line 12

Open in your IDE?
  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]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length180uniquetrue)]
  16.     private ?string $email null;
  17.     #[ORM\Column]
  18.     private array $roles = [];
  19.     /**
  20.      * @var string The hashed password
  21.      */
  22.     #[ORM\Column]
  23.     private ?string $password null;
  24.     #[ORM\Column(length255)]
  25.     private ?string $name null;
  26.     #[ORM\Column(length255)]
  27.     private ?string $ville null;
  28.     #[ORM\Column(nullabletrue)]
  29.     private ?bool $actif null;
  30.     public function __construct()
  31.     {
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getEmail(): ?string
  38.     {
  39.         return $this->email;
  40.     }
  41.     public function setEmail(string $email): self
  42.     {
  43.         $this->email $email;
  44.         return $this;
  45.     }
  46.     /**
  47.      * A visual identifier that represents this user.
  48.      *
  49.      * @see UserInterface
  50.      */
  51.     public function getUserIdentifier(): string
  52.     {
  53.         return (string) $this->email;
  54.     }
  55.     /**
  56.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  57.      */
  58.     public function getUsername(): string
  59.     {
  60.         return (string) $this->email;
  61.     }
  62.     /**
  63.      * @see UserInterface
  64.      */
  65.     public function getRoles(): array
  66.     {
  67.         $roles $this->roles;
  68.         // guarantee every user at least has ROLE_USER
  69.         $roles[] = 'ROLE_USER';
  70.         return array_unique($roles);
  71.     }
  72.     public function setRoles(array $roles): self
  73.     {
  74.         $this->roles $roles;
  75.         return $this;
  76.     }
  77.     /**
  78.      * @see PasswordAuthenticatedUserInterface
  79.      */
  80.     public function getPassword(): string
  81.     {
  82.         return $this->password;
  83.     }
  84.     public function setPassword(string $password): self
  85.     {
  86.         $this->password $password;
  87.         return $this;
  88.     }
  89.     /**
  90.      * Returning a salt is only needed, if you are not using a modern
  91.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  92.      *
  93.      * @see UserInterface
  94.      */
  95.     public function getSalt(): ?string
  96.     {
  97.         return null;
  98.     }
  99.     /**
  100.      * @see UserInterface
  101.      */
  102.     public function eraseCredentials()
  103.     {
  104.         // If you store any temporary, sensitive data on the user, clear it here
  105.         // $this->plainPassword = null;
  106.     }
  107.     public function getName(): ?string
  108.     {
  109.         return $this->name;
  110.     }
  111.     public function setName(string $name): self
  112.     {
  113.         $this->name $name;
  114.         return $this;
  115.     }
  116.     public function getVille(): ?string
  117.     {
  118.         return $this->ville;
  119.     }
  120.     public function setVille(string $ville): self
  121.     {
  122.         $this->ville $ville;
  123.         return $this;
  124.     }
  125.     public function isActif(): ?bool
  126.     {
  127.         return $this->actif;
  128.     }
  129.     public function setActif(?bool $actif): self
  130.     {
  131.         $this->actif $actif;
  132.         return $this;
  133.     }
  134. }