OrganizationDeletionRequest.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace App\ApiResources\Organization;
  3. use ApiPlatform\Metadata\ApiProperty;
  4. use ApiPlatform\Metadata\ApiResource;
  5. use ApiPlatform\Metadata\Post;
  6. use App\State\Processor\Organization\OrganizationDeletionRequestProcessor;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9. * Requête de création d'une nouvelle organisation
  10. */
  11. #[ApiResource(
  12. operations: [
  13. new Post(
  14. uriTemplate: '/internal/organization/delete',
  15. ),
  16. ],
  17. processor: OrganizationDeletionRequestProcessor::class
  18. )]
  19. class OrganizationDeletionRequest
  20. {
  21. /**
  22. * Id 'bidon' ajouté par défaut pour permettre la construction
  23. * de l'IRI par api platform.
  24. */
  25. #[ApiProperty(identifier: true)]
  26. private int $id = 0;
  27. private int $organizationId;
  28. /**
  29. * A quelle adresse email notifier la création de l'organisation, ou d'éventuelles erreurs ?
  30. * @var string|null
  31. */
  32. #[Assert\Email(message: 'The email {{ value }} is not a valid email.')]
  33. private ?string $sendConfirmationEmailAt = null;
  34. /**
  35. * For testing purposes only
  36. * @var bool
  37. */
  38. private bool $async = true;
  39. public function getId(): int
  40. {
  41. return $this->id;
  42. }
  43. public function setId(int $id): self
  44. {
  45. $this->id = $id;
  46. return $this;
  47. }
  48. public function getOrganizationId(): int
  49. {
  50. return $this->organizationId;
  51. }
  52. public function setOrganizationId(int $organizationId): self
  53. {
  54. $this->organizationId = $organizationId;
  55. return $this;
  56. }
  57. public function getSendConfirmationEmailAt(): ?string
  58. {
  59. return $this->sendConfirmationEmailAt;
  60. }
  61. public function setSendConfirmationEmailAt(?string $sendConfirmationEmailAt): self
  62. {
  63. $this->sendConfirmationEmailAt = $sendConfirmationEmailAt;
  64. return $this;
  65. }
  66. public function isAsync(): bool
  67. {
  68. return $this->async;
  69. }
  70. public function setAsync(bool $async): self
  71. {
  72. $this->async = $async;
  73. return $this;
  74. }
  75. }