OrganizationProfile.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\ApiResources\Profile;
  4. use ApiPlatform\Metadata\ApiProperty;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Get;
  7. use App\ApiResources\ApiResourcesInterface;
  8. use App\Enum\Organization\LegalEnum;
  9. use App\Enum\Organization\SettingsProductEnum;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. /**
  13. * Classe resource qui contient les champs relatifs aux organizations présentent dans la requete my_profile.
  14. */
  15. #[ApiResource(
  16. operations: [
  17. new Get(),
  18. ]
  19. )]
  20. class OrganizationProfile implements ApiResourcesInterface
  21. {
  22. #[ApiProperty(identifier: true)]
  23. #[Groups('access_profile_read')]
  24. public ?int $id = null;
  25. #[Groups('access_profile_read')]
  26. private ?string $name = null;
  27. #[Groups('access_profile_read')]
  28. #[Assert\Type(type: SettingsProductEnum::class)]
  29. private ?SettingsProductEnum $product = null;
  30. #[Groups('access_profile_read')]
  31. #[Assert\Type(type: LegalEnum::class)]
  32. private ?LegalEnum $legalStatus = null;
  33. /** @var list<string> $networks */
  34. #[Groups('access_profile_read')]
  35. private array $networks = [];
  36. #[Groups('access_profile_read')]
  37. private ?string $website = null;
  38. /** @var list<string> $modules */
  39. #[Groups('access_profile_read')]
  40. private ?array $modules = [];
  41. #[Groups('access_profile_read')]
  42. private bool $hasChildren = false;
  43. /** @var list<OrganizationProfile> */
  44. #[Groups('access_profile_read')]
  45. private ?array $parents = [];
  46. #[Groups('access_profile_read')]
  47. private bool $showAdherentList = false;
  48. #[Groups('access_profile_read')]
  49. private ?int $currentYear = null;
  50. #[Groups('access_profile_read')]
  51. private ?int $parametersId = null;
  52. public function getId(): ?int
  53. {
  54. return $this->id;
  55. }
  56. public function setId(?int $id): self
  57. {
  58. $this->id = $id;
  59. return $this;
  60. }
  61. public function getName(): ?string
  62. {
  63. return $this->name;
  64. }
  65. public function setName(?string $name): self
  66. {
  67. $this->name = $name;
  68. return $this;
  69. }
  70. public function getProduct(): ?SettingsProductEnum
  71. {
  72. return $this->product;
  73. }
  74. public function setProduct(?SettingsProductEnum $product): self
  75. {
  76. $this->product = $product;
  77. return $this;
  78. }
  79. public function getLegalStatus(): ?LegalEnum
  80. {
  81. return $this->legalStatus;
  82. }
  83. public function setLegalStatus(?LegalEnum $legalStatus): self
  84. {
  85. $this->legalStatus = $legalStatus;
  86. return $this;
  87. }
  88. /**
  89. * @return list<string>
  90. */
  91. public function getNetworks(): array
  92. {
  93. return $this->networks;
  94. }
  95. public function addNetwork(?string $network): self
  96. {
  97. $this->networks[] = $network;
  98. return $this;
  99. }
  100. public function getWebsite(): ?string
  101. {
  102. return $this->website;
  103. }
  104. public function setWebsite(?string $website): self
  105. {
  106. $this->website = $website;
  107. return $this;
  108. }
  109. /**
  110. * @return list<string>
  111. */
  112. public function getModules(): array
  113. {
  114. $modules = $this->modules;
  115. return array_unique($modules);
  116. }
  117. /**
  118. * @param list<string> $modules
  119. *
  120. * @return $this
  121. */
  122. public function setModules(array $modules): self
  123. {
  124. $this->modules = $modules;
  125. return $this;
  126. }
  127. public function getHasChildren(): bool
  128. {
  129. return $this->hasChildren;
  130. }
  131. public function setHasChildren(bool $hasChildren): self
  132. {
  133. $this->hasChildren = $hasChildren;
  134. return $this;
  135. }
  136. /**
  137. * @return list<OrganizationProfile>
  138. */
  139. public function getParents(): array
  140. {
  141. return $this->parents;
  142. }
  143. public function addParent(OrganizationProfile $parent): self
  144. {
  145. $this->parents[] = $parent;
  146. return $this;
  147. }
  148. public function getShowAdherentList(): bool
  149. {
  150. return $this->showAdherentList;
  151. }
  152. public function setShowAdherentList(bool $showAdherentList): self
  153. {
  154. $this->showAdherentList = $showAdherentList;
  155. return $this;
  156. }
  157. public function getCurrentYear(): ?int
  158. {
  159. return $this->currentYear;
  160. }
  161. public function setCurrentYear(?int $currentYear): self
  162. {
  163. $this->currentYear = $currentYear;
  164. return $this;
  165. }
  166. public function getParametersId(): ?int
  167. {
  168. return $this->parametersId;
  169. }
  170. public function setParametersId(?int $parametersId): self
  171. {
  172. $this->parametersId = $parametersId;
  173. return $this;
  174. }
  175. }