src/Entity/User.php line 14

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. /**
  8.  * @ORM\Entity(repositoryClass=UserRepository::class)
  9.  * @ORM\Table(name="user")
  10.  */
  11. class User implements UserInterfacePasswordAuthenticatedUserInterface
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=180, unique=true)
  21.      */
  22.     private $email;
  23.     /**
  24.      * @ORM\Column(type="json")
  25.      */
  26.     private $roles = [];
  27.     /**
  28.      * @ORM\Column(type="string")
  29.      */
  30.     private $password;
  31.     /**
  32.      * @ORM\Column(type="boolean")
  33.      */
  34.     private $enabled true;
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getEmail(): ?string
  40.     {
  41.         return $this->email;
  42.     }
  43.     public function setEmail(string $email): self
  44.     {
  45.         $this->email $email;
  46.         return $this;
  47.     }
  48.     public function getUserIdentifier(): string
  49.     {
  50.         return (string) $this->email;
  51.     }
  52.     public function getUsername(): string
  53.     {
  54.         return (string) $this->email;
  55.     }
  56.     public function getRoles(): array
  57.     {
  58.         $roles $this->roles;
  59.         if (!in_array('ROLE_USER'$rolestrue)) {
  60.             $roles[] = 'ROLE_USER';
  61.         }
  62.         return array_values(array_unique($roles));
  63.     }
  64.     public function setRoles(array $roles): self
  65.     {
  66.         $this->roles $roles;
  67.         return $this;
  68.     }
  69.     public function getPassword(): string
  70.     {
  71.         return (string) $this->password;
  72.     }
  73.     public function setPassword(string $password): self
  74.     {
  75.         $this->password $password;
  76.         return $this;
  77.     }
  78.     public function isEnabled(): bool
  79.     {
  80.         return (bool) $this->enabled;
  81.     }
  82.     public function setEnabled(bool $enabled): self
  83.     {
  84.         $this->enabled $enabled;
  85.         return $this;
  86.     }
  87.     public function getSalt(): ?string
  88.     {
  89.         return null;
  90.     }
  91.     public function eraseCredentials()
  92.     {
  93.     }
  94. }