src/Infrastructure/Doctrine/Entity/DoctrineBaseUser.php line 25

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Infrastructure\Doctrine\Entity;
  4. use App\Domain\Common\Entity\BaseUser;
  5. use App\Infrastructure\Doctrine\Entity\Traits\EnabledTrait;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  9. /**
  10.  * @ORM\Entity(repositoryClass="App\Infrastructure\Doctrine\Repository\DoctrineBaseUserRepository")
  11.  *
  12.  * @ORM\InheritanceType("JOINED")
  13.  * @ORM\DiscriminatorMap({
  14.  *     "iz_order_client" = "DoctrineIzOrderClient",
  15.  *     "admin" = "DoctrineUserAdmin",
  16.  *     "agent" = "DoctrineUserAgent",
  17.  * })
  18.  *
  19.  * @UniqueEntity(fields={"codeClient"}, message="Cet identifiant est déjà utilisé.")
  20.  */
  21. abstract class DoctrineBaseUser implements BaseUserPasswordAuthenticatedUserInterface
  22. {
  23.     use EnabledTrait;
  24.     /**
  25.      * @ORM\Id
  26.      * @ORM\Column(type="string", length=16, unique=true)
  27.      */
  28.     protected string $codeClient '';
  29.     /**
  30.      * @ORM\Column(type="string", length=191, nullable=true)
  31.      */
  32.     protected ?string $email null;
  33.     /**
  34.      * @ORM\Column(type="string", length=191, nullable=true)
  35.      */
  36.     protected ?string $password null;
  37.     /**
  38.      * @ORM\Column(type="string", length=191, nullable=true)
  39.      */
  40.     protected ?string $resetPasswordToken;
  41.     abstract public function getRoles(): array;
  42.     public function getCodeClient(): string
  43.     {
  44.         return $this->codeClient;
  45.     }
  46.     public function setCodeClient(string $codeClient): void
  47.     {
  48.         $this->codeClient $codeClient;
  49.     }
  50.     public function getEmail(): ?string
  51.     {
  52.         return $this->email;
  53.     }
  54.     public function setEmail(?string $email): void
  55.     {
  56.         $this->email $email;
  57.     }
  58.     public function getPassword(): ?string
  59.     {
  60.         return $this->password;
  61.     }
  62.     public function setPassword(?string $password): void
  63.     {
  64.         $this->password $password;
  65.     }
  66.     public function getSalt(): ?string
  67.     {
  68.         return null;
  69.     }
  70.     public function getUserIdentifier(): string
  71.     {
  72.         return $this->codeClient;
  73.     }
  74.     public function getResetPasswordToken(): ?string
  75.     {
  76.         return $this->resetPasswordToken;
  77.     }
  78.     public function setResetPasswordToken(?string $resetPasswordToken): void
  79.     {
  80.         $this->resetPasswordToken $resetPasswordToken;
  81.     }
  82.     // EasyAdmin a encore besoin de cette méthode
  83.     public function getUsername(): string
  84.     {
  85.         return $this->getUserIdentifier();
  86.     }
  87.     public function eraseCredentials(): void
  88.     {
  89.     }
  90. }