HelloAsso.php 3.9 KB

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