vendor/ksante/ksante_bundlesso/src/Entity/User.php line 14

Open in your IDE?
  1. <?php
  2. namespace Ksante\SsoBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  5. use Symfony\Component\Security\Core\User\UserInterface;
  6. use Ksante\SsoBundle\Repository\UserRepository;
  7. /**
  8.  * @ORM\Entity(repositoryClass=UserRepository::class)
  9.  * @ORM\Table(name="ksante_user")
  10.  */
  11. class User implements UserInterfacePasswordAuthenticatedUserInterface
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     protected $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=180, unique=true)
  21.      */
  22.     protected $email;
  23.     /**
  24.      * @ORM\Column(type="json")
  25.      */
  26.     protected $roles = [];
  27.     /**
  28.      * @ORM\Column(type="string", nullable=true)
  29.      */
  30.     private $password;
  31.     /**
  32.      * @ORM\Column(name="enabled", type="boolean")
  33.      */
  34.     protected $enabled true;
  35.     /**
  36.      * @ORM\Column(name="connected_at", type="datetime", nullable=true)
  37.      */
  38.     protected $connectedAt;
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getEmail(): ?string
  44.     {
  45.         return $this->email;
  46.     }
  47.     public function setEmail(string $email): self
  48.     {
  49.         $this->email strtolower($email);
  50.         return $this;
  51.     }
  52.     /**
  53.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  54.      */
  55.     public function getUsername(): string
  56.     {
  57.         return (string) $this->email;
  58.     }
  59.     /**
  60.      * @see UserInterface
  61.      */
  62.     public function getRoles(): array
  63.     {
  64.         $roles $this->roles;
  65.         // guarantee every user at least has ROLE_USER
  66.         $roles[] = 'ROLE_USER';
  67.         return array_unique($roles);
  68.     }
  69.     public function setRoles(array $roles): self
  70.     {
  71.         $this->roles $roles;
  72.         return $this;
  73.     }
  74.     /**
  75.      * A visual identifier that represents this user.
  76.      *
  77.      * @see UserInterface
  78.      */
  79.     public function getUserIdentifier(): string
  80.     {
  81.         return (string) $this->email;
  82.     }
  83.     public function getPassword(): ?string
  84.     {
  85.         return $this->password;
  86.     }
  87.     public function setPassword(string $password): self
  88.     {
  89.         $this->password $password;
  90.         return $this;
  91.     }
  92.     /**
  93.      * @see UserInterface
  94.      */
  95.     public function getSalt()
  96.     {
  97.         // not needed for apps that do not check user passwords
  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.     }
  106.     public function isEnabled(): bool
  107.     {
  108.         return $this->enabled;
  109.     }
  110.     public function setEnabled(?bool $enabled): void
  111.     {
  112.         $this->enabled = (bool) $enabled;
  113.     }
  114.     public function getConnectedAt(): ?\DateTimeInterface
  115.     {
  116.         return $this->connectedAt;
  117.     }
  118.     public function setConnectedAt(?\DateTimeInterface $connectedAt): self
  119.     {
  120.         $this->connectedAt $connectedAt;
  121.         return $this;
  122.     }
  123. }