src/Entity/User/ShopUser.php line 20

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\User;
  4. use App\Entity\Customer\Customer;
  5. use App\Trait\Archivable;
  6. use DateTime;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface;
  11. use Sylius\Component\Core\Model\ShopUser as BaseShopUser;
  12. use TheCodingMachine\DoubleAuthenticationPlugin\Model\TcmDoubleAuthenticationPluginTrait;
  13. /** @method Customer|null getCustomer() */
  14. #[ORM\Table(name'sylius_shop_user')]
  15. #[ORM\Entity]
  16. class ShopUser extends BaseShopUser implements TwoFactorInterface
  17. {
  18.     use TcmDoubleAuthenticationPluginTrait;
  19.     use Archivable;
  20.     #[ORM\Column(name'enabled_at'type'datetime'nullabletrue)]
  21.     private DateTime|null $enabledAt null;
  22.     #[ORM\Column(name'disabled_at'type'datetime'nullabletrue)]
  23.     private DateTime|null $disabledAt null;
  24.     #[ORM\Column(name'must_change_password'type'boolean'options: ['default' => true])]
  25.     private bool $mustChangePassword true;
  26.     #[ORM\Column(name'password_changed_at'type'datetime'nullabletrue)]
  27.     private DateTime|null $passwordChangedAt null;
  28.     #[ORM\OneToMany(mappedBy'shopUser'targetEntityVerificationToken::class, cascade: ['all'], orphanRemovaltrue)]
  29.     private Collection $verificationTokens;
  30.     #[ORM\Column(name'account_status'type'string'length50options: ['default' => 'pending'])]
  31.     private string $accountStatus 'pending';
  32.     #[ORM\Column(name'first_login_at'type'datetime'nullabletrue)]
  33.     private DateTime|null $firstLoginAt null;
  34.     public function __construct()
  35.     {
  36.         parent::__construct();
  37.         $this->verificationTokens = new ArrayCollection();
  38.     }
  39.     public function getGoogleAuthenticatorUsername(): string
  40.     {
  41.         return $this->getEmail() ?: '';
  42.     }
  43.     public function getEnabledAt(): DateTime|null
  44.     {
  45.         return $this->enabledAt;
  46.     }
  47.     public function setEnabledAt(DateTime|null $enabledAt): void
  48.     {
  49.         $this->enabledAt $enabledAt;
  50.     }
  51.     public function getDisabledAt(): DateTime|null
  52.     {
  53.         return $this->disabledAt;
  54.     }
  55.     public function setDisabledAt(DateTime|null $disabledAt): void
  56.     {
  57.         $this->disabledAt $disabledAt;
  58.     }
  59.     public function isLocked(): bool
  60.     {
  61.         return $this->locked;
  62.     }
  63.     public function isMustChangePassword(): bool
  64.     {
  65.         return $this->mustChangePassword;
  66.     }
  67.     public function setMustChangePassword(bool $mustChangePassword): void
  68.     {
  69.         $this->mustChangePassword $mustChangePassword;
  70.     }
  71.     public function getPasswordChangedAt(): DateTime|null
  72.     {
  73.         return $this->passwordChangedAt;
  74.     }
  75.     public function setPasswordChangedAt(DateTime|null $passwordChangedAt): void
  76.     {
  77.         $this->passwordChangedAt $passwordChangedAt;
  78.     }
  79.     /** @return Collection<array-key, VerificationToken> */
  80.     public function getVerificationTokens(): Collection
  81.     {
  82.         return $this->verificationTokens;
  83.     }
  84.     /** @param Collection<array-key, VerificationToken> $verificationTokens */
  85.     public function setVerificationToken(Collection $verificationTokens): void
  86.     {
  87.         $this->verificationTokens $verificationTokens;
  88.     }
  89.     public function addVerificationToken(VerificationToken $verificationToken): self
  90.     {
  91.         if (! $this->verificationTokens->contains($verificationToken)) {
  92.             $this->verificationTokens[] = $verificationToken;
  93.         }
  94.         return $this;
  95.     }
  96.     public function removeVerificationToken(VerificationToken $verificationToken): void
  97.     {
  98.         $this->verificationTokens->removeElement($verificationToken);
  99.     }
  100.     public function getAccountStatus(): string
  101.     {
  102.         return $this->accountStatus;
  103.     }
  104.     public function setAccountStatus(string $accountStatus): void
  105.     {
  106.         $this->accountStatus $accountStatus;
  107.     }
  108.     public function getFirstLoginAt(): DateTime|null
  109.     {
  110.         return $this->firstLoginAt;
  111.     }
  112.     public function setFirstLoginAt(DateTime|null $firstLoginAt): void
  113.     {
  114.         $this->firstLoginAt $firstLoginAt;
  115.     }
  116. }