src/Entity/YoutubeAuth.php line 14

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use App\Services\Youtube\Dto\YoutubeAuthDto;
  5. use DateTimeImmutable;
  6. use Doctrine\ORM\Mapping\Column;
  7. use Doctrine\ORM\Mapping\Entity;
  8. use Doctrine\ORM\Mapping\Id;
  9. #[Entity]
  10. class YoutubeAuth
  11. {
  12.     #[Id]
  13.     #[Column(type'string'uniquetrue)]
  14.     private string $id;
  15.     #[Column(type'string'uniquetruenullabletrue)]
  16.     private ?string $channelId null;
  17.     #[Column(type'string'nullablefalse)]
  18.     private string $accessToken;
  19.     #[Column(type'string'nullablefalse)]
  20.     private string $refreshToken;
  21.     #[Column(type'text'nullablefalse)]
  22.     private string $scope;
  23.     #[Column(type'string'nullablefalse)]
  24.     private string $tokenType;
  25.     #[Column(type'integer'nullablefalse)]
  26.     private int $expiredIn;
  27.     #[Column(type'datetime_immutable'nullablefalse)]
  28.     private DateTimeImmutable $createdAt;
  29.     public function __construct(
  30.         string $id,
  31.         string $accessToken,
  32.         string $refreshToken,
  33.         string $scope,
  34.         string $tokenType,
  35.         int $expiredIn,
  36.         DateTimeImmutable $createdAt,
  37.     ) {
  38.         $this->id $id;
  39.         $this->accessToken $accessToken;
  40.         $this->refreshToken $refreshToken;
  41.         $this->scope $scope;
  42.         $this->tokenType $tokenType;
  43.         $this->expiredIn $expiredIn;
  44.         $this->createdAt $createdAt;
  45.     }
  46.     public function getId(): string
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getChannelId(): ?string
  51.     {
  52.         return $this->channelId;
  53.     }
  54.     public function setChannelId(string $channelId): static
  55.     {
  56.         $this->channelId $channelId;
  57.         return $this;
  58.     }
  59.     public function getAccessToken(): string
  60.     {
  61.         return $this->accessToken;
  62.     }
  63.     public function setAccessToken(string $accessToken): static
  64.     {
  65.         $this->accessToken $accessToken;
  66.         return $this;
  67.     }
  68.     public function getRefreshToken(): string
  69.     {
  70.         return $this->refreshToken;
  71.     }
  72.     public function setRefreshToken(string $refreshToken): static
  73.     {
  74.         $this->refreshToken $refreshToken;
  75.         return $this;
  76.     }
  77.     public function getScope(): string
  78.     {
  79.         return $this->scope;
  80.     }
  81.     public function setScope(string $scope): static
  82.     {
  83.         $this->scope $scope;
  84.         return $this;
  85.     }
  86.     public function getTokenType(): string
  87.     {
  88.         return $this->tokenType;
  89.     }
  90.     public function setTokenType(string $tokenType): static
  91.     {
  92.         $this->tokenType $tokenType;
  93.         return $this;
  94.     }
  95.     public function getExpiredIn(): int
  96.     {
  97.         return $this->expiredIn;
  98.     }
  99.     public function setExpiredIn(int $expiredIn): static
  100.     {
  101.         $this->expiredIn $expiredIn;
  102.         return $this;
  103.     }
  104.     public function getCreatedAt(): DateTimeImmutable
  105.     {
  106.         return $this->createdAt;
  107.     }
  108.     public function setCreatedAt(DateTimeImmutable $createdAt): static
  109.     {
  110.         $this->createdAt $createdAt;
  111.         return $this;
  112.     }
  113.     public function toDto(): YoutubeAuthDto
  114.     {
  115.         return new YoutubeAuthDto(
  116.             $this->getId(),
  117.             $this->getAccessToken(),
  118.         );
  119.     }
  120. }