HelloAsso.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\HelloAsso;
  4. use App\Entity\Organization\Organization;
  5. use App\Repository\HelloAsso\HelloAssoRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * HelloAsso entity for storing HelloAsso connection information.
  9. *
  10. * @see https://dev.helloasso.com/docs/mire-authorisation
  11. */
  12. #[ORM\Entity(repositoryClass: HelloAssoRepository::class)]
  13. #[ORM\Table]
  14. class HelloAsso
  15. {
  16. #[ORM\Id]
  17. #[ORM\Column]
  18. #[ORM\GeneratedValue]
  19. private ?int $id = null;
  20. #[ORM\OneToOne(targetEntity: Organization::class, inversedBy: 'helloAsso')]
  21. #[ORM\JoinColumn(name: 'organization_id', referencedColumnName: 'id', nullable: false)]
  22. private Organization $organization;
  23. /**
  24. * La valeur utilisée pour générer le challenge PCKE; à conserver en base le temps de l'authentification HelloAsso.
  25. */
  26. #[ORM\Column(type: 'text', nullable: true)]
  27. private ?string $challengeVerifier = null;
  28. /**
  29. * Le token d'authentification HelloAsso, valable 30min.'.
  30. */
  31. #[ORM\Column(type: 'text', nullable: true)]
  32. private ?string $token = null;
  33. /**
  34. * Date à laquelle le token a été généré.
  35. *
  36. * @var \DateTimeInterface|null
  37. */
  38. #[ORM\Column(type: 'datetime', nullable: true)]
  39. private $tokenCreatedAt;
  40. /**
  41. * Un autre jeton, valable 30jours, permettant de regénérer le token d'authentification HelloAsso.'.
  42. */
  43. #[ORM\Column(type: 'text', nullable: true)]
  44. private ?string $refreshToken = null;
  45. /**
  46. * Date à laquelle le refreshToken a été généré.
  47. *
  48. * @var \DateTimeInterface|null
  49. */
  50. #[ORM\Column(type: 'datetime', nullable: true)]
  51. private $refreshTokenCreatedAt;
  52. /**
  53. * Le slug de l'organisation sur HelloAsso.
  54. */
  55. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  56. private ?string $organizationSlug = null;
  57. public function getId(): ?int
  58. {
  59. return $this->id;
  60. }
  61. public function setId(?int $id): self
  62. {
  63. $this->id = $id;
  64. return $this;
  65. }
  66. public function getOrganization(): Organization
  67. {
  68. return $this->organization;
  69. }
  70. public function setOrganization(Organization $organization): self
  71. {
  72. $this->organization = $organization;
  73. return $this;
  74. }
  75. public function getChallengeVerifier(): ?string
  76. {
  77. return $this->challengeVerifier;
  78. }
  79. public function setChallengeVerifier(?string $challengeVerifier): self
  80. {
  81. $this->challengeVerifier = $challengeVerifier;
  82. return $this;
  83. }
  84. public function getToken(): ?string
  85. {
  86. return $this->token;
  87. }
  88. public function setToken(?string $token): self
  89. {
  90. $this->token = $token;
  91. return $this;
  92. }
  93. public function getTokenCreatedAt(): ?\DateTimeInterface
  94. {
  95. return $this->tokenCreatedAt;
  96. }
  97. public function setTokenCreatedAt(?\DateTimeInterface $tokenCreatedAt): self
  98. {
  99. $this->tokenCreatedAt = $tokenCreatedAt;
  100. return $this;
  101. }
  102. public function getRefreshToken(): ?string
  103. {
  104. return $this->refreshToken;
  105. }
  106. public function setRefreshToken(?string $refreshToken): self
  107. {
  108. $this->refreshToken = $refreshToken;
  109. return $this;
  110. }
  111. public function getRefreshTokenCreatedAt(): ?\DateTimeInterface
  112. {
  113. return $this->refreshTokenCreatedAt;
  114. }
  115. public function setRefreshTokenCreatedAt(?\DateTimeInterface $refreshTokenCreatedAt): self
  116. {
  117. $this->refreshTokenCreatedAt = $refreshTokenCreatedAt;
  118. return $this;
  119. }
  120. public function getOrganizationSlug(): ?string
  121. {
  122. return $this->organizationSlug;
  123. }
  124. public function setOrganizationSlug(?string $organizationSlug): self
  125. {
  126. $this->organizationSlug = $organizationSlug;
  127. return $this;
  128. }
  129. }