src/Entity/RefreshTokens.php line 10

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RefreshTokensRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClass: RefreshTokensRepository::class)]
  6. class RefreshTokens
  7. {
  8. #[ORM\Id]
  9. #[ORM\GeneratedValue]
  10. #[ORM\Column(type: 'integer')]
  11. private $id;
  12. #[ORM\Column(type: 'string', length: 255)]
  13. private $token;
  14. #[ORM\Column(type: 'datetime')]
  15. private $modified;
  16. #[ORM\Column(type: 'datetime')]
  17. private $created;
  18. #[ORM\ManyToOne(targetEntity: ApiDetails::class, inversedBy: 'refreshTokens')]
  19. private $api;
  20. public function __construct()
  21. {
  22. $date = new \DateTime("now", new \DateTimeZone('Asia/Dubai'));
  23. $this->setModified($date);
  24. if ($this->getCreated() == null)
  25. {
  26. $this->setCreated($date);
  27. }
  28. }
  29. public function getId(): ?int
  30. {
  31. return $this->id;
  32. }
  33. public function getToken(): ?string
  34. {
  35. return $this->token;
  36. }
  37. public function setToken(string $token): self
  38. {
  39. $this->token = $token;
  40. return $this;
  41. }
  42. public function getModified(): ?\DateTimeInterface
  43. {
  44. return $this->modified;
  45. }
  46. public function setModified(\DateTimeInterface $modified): self
  47. {
  48. $this->modified = $modified;
  49. return $this;
  50. }
  51. public function getCreated(): ?\DateTimeInterface
  52. {
  53. return $this->created;
  54. }
  55. public function setCreated(\DateTimeInterface $created): self
  56. {
  57. $this->created = $created;
  58. return $this;
  59. }
  60. public function getApiDetails(): ?ApiDetails
  61. {
  62. return $this->api;
  63. }
  64. public function setApiDetails(?ApiDetails $api): self
  65. {
  66. $this->api = $api;
  67. return $this;
  68. }
  69. }