src/Containers/CrmSection/ClientContainer/Entities/GuestEntity.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Containers\CrmSection\ClientContainer\Entities;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\DBAL\Types\Types;
  5. use App\Ship\Entities\UserEntity;
  6. use App\Containers\CrmSection\ClientContainer\Data\Repositories\GuestRepository;
  7. /** 
  8.  * Гость
  9. */
  10. #[ORM\Entity(repositoryClassGuestRepository::class)]
  11. #[ORM\Table(name'`crm_guests`')]
  12. class GuestEntity extends UserEntity
  13. {
  14.     // Токен
  15.     #[ORM\Column(typeTypes::STRINGnullablefalse)]
  16.     private string $token;
  17.     // Реферальный код
  18.     #[ORM\Column(typeTypes::STRINGlength255nullabletrue)]
  19.     public ?string $referrerCode null;
  20.     // Данные
  21.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  22.     private ?string $data null;
  23.     public function getToken(): string
  24.     {
  25.         return $this->token;
  26.     }
  27.     public function setToken($token)
  28.     {
  29.         $this->token $token;
  30.         return $this;
  31.     }
  32.     public function getReferrerCode()
  33.     {
  34.         return $this->referrerCode;
  35.     }
  36.     public function setReferrerCode($code)
  37.     {
  38.         $this->referrerCode $code;
  39.         return $this;
  40.     }
  41.     public function getData()
  42.     {
  43.         return json_decode($this->data ?? '[]'true);
  44.     }
  45.     public function setData($data)
  46.     {
  47.         $this->data json_encode($data);
  48.         return $this;
  49.     }
  50.     public function getRoles(): array
  51.     {
  52.         $roles $this->roles;
  53.         // guarantee every user at least has ROLE_GUEST
  54.         $roles[] = 'ROLE_USER_GUEST';
  55.         return \array_unique($roles);
  56.     }
  57. }