src/Entity/User/AdminUser.php line 19

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\User;
  4. use Arobases\SyliusRightsManagementPlugin\Entity\AdminUserInterface;
  5. use Arobases\SyliusRightsManagementPlugin\Entity\AdminUserTrait;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
  8. use Sylius\Component\Core\Model\AdminUser as BaseAdminUser;
  9. /**
  10.  * @ORM\Entity
  11.  * @ORM\Table(name="sylius_admin_user")
  12.  *
  13.  * @method string getUserIdentifier()
  14.  */
  15. class AdminUser extends BaseAdminUser implements AdminUserInterfaceTwoFactorInterface
  16. {
  17.     use AdminUserTrait;
  18.     /** @ORM\Column(type="string", nullable=true) */
  19.     private ?string $authCode;
  20.     // [...]
  21.     public function isEmailAuthEnabled(): bool
  22.     {
  23.         return true// This can be a persisted field to switch email code authentication on/off
  24.     }
  25.     public function getEmailAuthRecipient(): string
  26.     {
  27.         return $this->email;
  28.     }
  29.     public function getEmailAuthCode(): string
  30.     {
  31.         if (null === $this->authCode) {
  32.             throw new \LogicException('The email authentication code was not set');
  33.         }
  34.         return $this->authCode;
  35.     }
  36.     public function setEmailAuthCode(string $authCode): void
  37.     {
  38.         $this->authCode $authCode;
  39.     }
  40. }