src/Entity/User.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Flagstone\BaseEntityBundle\BaseEntity\AbstractMappedSuperclass;
  4. use Flagstone\UuidDoctrineBridgeBundle\UuidDoctrineBridge\Interfaces\UuidInterface;
  5. use Flagstone\UuidDoctrineBridgeBundle\UuidDoctrineBridge\Traits\UuidGenerator;
  6. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  7. use Symfony\Component\Security\Core\User\UserInterface;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * Class User
  11.  * @package App\Entity
  12.  *
  13.  * @ORM\Entity(
  14.  *     repositoryClass = "App\Repository\UserRepository"
  15.  * )
  16.  *
  17.  * @ORM\Table(
  18.  *     name = "user"
  19.  * )
  20.  *
  21.  */
  22. class User extends AbstractMappedSuperclass implements UuidInterfaceUserInterfacePasswordAuthenticatedUserInterface
  23. {
  24.     use UuidGenerator;
  25.     /**
  26.      * @var string
  27.      * @ORM\Column(
  28.      *     name = "email",
  29.      *     type = "string",
  30.      *     length = "128"
  31.      * )
  32.      */
  33.     private string $email;
  34.     /**
  35.      * @var string
  36.      * @ORM\Column(
  37.      *     name = "password",
  38.      *     type = "string",
  39.      *     length = "128"
  40.      * )
  41.      */
  42.     private string $password;
  43.     /**
  44.      * @var string
  45.      */
  46.     private string $plainPassword;
  47.     /**
  48.      * @var array
  49.      * @ORM\Column(
  50.      *     name = "roles",
  51.      *     type = "json"
  52.      * )
  53.      */
  54.     private array $roles;
  55.     public function getEmail(): string
  56.     {
  57.         return $this->email;
  58.     }
  59.     public function getPassword(): string
  60.     {
  61.         return $this->password;
  62.     }
  63.     public function getUserIdentifier(): string
  64.     {
  65.         return $this->email;
  66.     }
  67.     public function getUsername(): string
  68.     {
  69.         return $this->email;
  70.     }
  71.     public function getRoles(): array
  72.     {
  73.         $roles $this->roles;
  74.         $roles[] = 'ROLE_USER';
  75.         return array_unique($roles);
  76.     }
  77.     public function setEmail(?string $email): User
  78.     {
  79.         $this->email $email;
  80.         return $this;
  81.     }
  82.     public function setPassword(?string $password): User
  83.     {
  84.         $this->password $password;
  85.         return $this;
  86.     }
  87.     public function setRoles(array $roles): User
  88.     {
  89.         $this->roles $roles;
  90.         return $this;
  91.     }
  92.     public function getSalt()
  93.     {
  94.         return null;
  95.     }
  96.     public function eraseCredentials()
  97.     {
  98.         // TODO: Implement eraseCredentials() method.
  99.     }
  100. }