EventForm.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\ApiResources\HelloAsso;
  4. use ApiPlatform\Metadata\ApiProperty;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Get;
  7. use ApiPlatform\Metadata\GetCollection;
  8. use ApiPlatform\Metadata\Link;
  9. use App\State\Provider\HelloAsso\AuthUrlProvider;
  10. use App\State\Provider\HelloAsso\HelloAssoProfileProvider;
  11. use App\State\Provider\HelloAsso\EventFormProvider;
  12. /**
  13. * Retourne les formulaires d'une organisation.
  14. */
  15. #[ApiResource(
  16. operations: [
  17. new GetCollection(
  18. uriTemplate: '/helloasso/forms',
  19. ),
  20. new Get(
  21. uriTemplate: '/helloasso/form/{slug}',
  22. ),
  23. new Get(
  24. uriTemplate: '/public/helloasso/form/by-event/{eventId}',
  25. uriVariables: [
  26. 'eventId' => new Link(
  27. fromProperty: 'eventId',
  28. identifiers: ['eventId']
  29. )
  30. ]
  31. )
  32. ],
  33. provider: EventFormProvider::class,
  34. )]
  35. class EventForm
  36. {
  37. /**
  38. * Slug du formulaire
  39. */
  40. #[ApiProperty(identifier: true)]
  41. private ?string $slug = null;
  42. /**
  43. * Id de l'Event auquel le formulaire est associé
  44. * @var int | null
  45. */
  46. private ?int $eventId = null;
  47. /**
  48. * Titre du formulaire
  49. * @var string|null
  50. */
  51. private ?string $title = null;
  52. /**
  53. * Url du formulaire
  54. */
  55. private ?string $widgetUrl = null;
  56. public function getSlug(): ?string
  57. {
  58. return $this->slug;
  59. }
  60. public function setSlug(?string $slug): self
  61. {
  62. $this->slug = $slug;
  63. return $this;
  64. }
  65. public function getEventId(): ?int
  66. {
  67. return $this->eventId;
  68. }
  69. public function setEventId(?int $eventId): self
  70. {
  71. $this->eventId = $eventId;
  72. return $this;
  73. }
  74. public function getTitle(): ?string
  75. {
  76. return $this->title;
  77. }
  78. public function setTitle(?string $title): self
  79. {
  80. $this->title = $title;
  81. return $this;
  82. }
  83. public function getWidgetUrl(): ?string
  84. {
  85. return $this->widgetUrl;
  86. }
  87. public function setWidgetUrl(?string $widgetUrl): self
  88. {
  89. $this->widgetUrl = $widgetUrl;
  90. return $this;
  91. }
  92. }