src/Entity/AccessToken.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use App\Repository\AccessTokenRepository;
  6. use ApiPlatform\Core\Annotation\ApiResource;
  7. use App\Entity\Interfaces\ContainerMappedInterface;
  8. /**
  9.  * @ApiResource()
  10.  * @ORM\Entity(repositoryClass=AccessTokenRepository::class)
  11.  */
  12. class AccessToken implements ContainerMappedInterface
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @var \DateTime
  22.      * @Gedmo\Timestampable(on="create")
  23.      * @ORM\Column(type="datetime")
  24.      */
  25.     protected $createdAt;
  26.     /**
  27.      * @ORM\Column(type="text")
  28.      */
  29.     private $token;
  30.     /**
  31.      * @ORM\Column(type="datetime")
  32.      */
  33.     private $expireAt;
  34.     /**
  35.      * @ORM\Column(type="boolean", nullable=true)
  36.      */
  37.     private $isActive;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=User::class)
  40.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  41.      */
  42.     private $user;
  43.     /**
  44.      * @ORM\ManyToOne(targetEntity=Container::class)
  45.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  46.      */
  47.     private $container;
  48.     /**
  49.      * @ORM\Column(type="string", length=255)
  50.      */
  51.     private $refreshToken;
  52.     /**
  53.      * @ORM\Column(type="datetime")
  54.      */
  55.     private $rtExpireAt;
  56.     /**
  57.      * @ORM\Column(type="string", length=255, nullable=true)
  58.      */
  59.     private $shortToken;
  60.     
  61.     public function setCreatedAt(\DateTime $createdAt)
  62.     {
  63.         $this->createdAt $createdAt;
  64.         return $this;
  65.     }
  66.     
  67.     public function getCreatedAt()
  68.     {
  69.         return $this->createdAt;
  70.     }
  71.     public function getId(): ?int
  72.     {
  73.         return $this->id;
  74.     }
  75.     public function getToken(): ?string
  76.     {
  77.         return $this->token;
  78.     }
  79.     public function setToken(string $token): self
  80.     {
  81.         $this->token $token;
  82.         return $this;
  83.     }
  84.     public function getExpireAt(): ?\DateTimeInterface
  85.     {
  86.         return $this->expireAt;
  87.     }
  88.     public function setExpireAt(\DateTimeInterface $expireAt): self
  89.     {
  90.         $this->expireAt $expireAt;
  91.         return $this;
  92.     }
  93.     public function getIsActive(): ?bool
  94.     {
  95.         return $this->isActive;
  96.     }
  97.     public function setIsActive(?bool $isActive): self
  98.     {
  99.         $this->isActive $isActive;
  100.         return $this;
  101.     }
  102.     public function getUser(): ?User
  103.     {
  104.         return $this->user;
  105.     }
  106.     public function setUser(?User $user): self
  107.     {
  108.         $this->user $user;
  109.         return $this;
  110.     }
  111.     public function getContainer(): ?Container
  112.     {
  113.         return $this->container;
  114.     }
  115.     public function setContainer(?Container $container): self
  116.     {
  117.         $this->container $container;
  118.         return $this;
  119.     }
  120.     public function getRefreshToken(): ?string
  121.     {
  122.         return $this->refreshToken;
  123.     }
  124.     public function setRefreshToken(string $refreshToken): self
  125.     {
  126.         $this->refreshToken $refreshToken;
  127.         return $this;
  128.     }
  129.     public function getRtExpireAt(): ?\DateTimeInterface
  130.     {
  131.         return $this->rtExpireAt;
  132.     }
  133.     public function setRtExpireAt(\DateTimeInterface $rtExpireAt): self
  134.     {
  135.         $this->rtExpireAt $rtExpireAt;
  136.         return $this;
  137.     }
  138.     public function getShortToken(): ?string
  139.     {
  140.         return $this->shortToken;
  141.     }
  142.     public function setShortToken(?string $shortToken): self
  143.     {
  144.         $this->shortToken $shortToken;
  145.         return $this;
  146.     }
  147. }