OrganizationMemberCreationRequest.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <?php
  2. namespace App\ApiResources\Organization;
  3. use App\Enum\Core\FileTypeEnum;
  4. use App\Enum\Person\GenderEnum;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7. * Requête de création d'un nouvel access.
  8. */
  9. class OrganizationMemberCreationRequest
  10. {
  11. #[Assert\Type(type: FileTypeEnum::class)]
  12. private GenderEnum $gender = GenderEnum::MISTER;
  13. #[Assert\Regex(pattern: '/^[a-z0-9\-]{3,}$/')]
  14. private string $username;
  15. #[Assert\Length(
  16. min: 1,
  17. minMessage: 'Name must be at least {{ limit }} characters long',
  18. )]
  19. private string $name;
  20. #[Assert\Length(
  21. min: 1,
  22. minMessage: 'Given name must be at least {{ limit }} characters long',
  23. )]
  24. private string $givenName;
  25. #[Assert\Length(
  26. min: 1,
  27. minMessage: 'Street address must be at least {{ limit }} characters long',
  28. )]
  29. private string $streetAddress1;
  30. private ?string $streetAddress2 = null;
  31. private ?string $streetAddress3 = null;
  32. #[Assert\Length(
  33. min: 3,
  34. minMessage: 'Postal code must be at least {{ limit }} characters long',
  35. )]
  36. private string $postalCode;
  37. #[Assert\Length(
  38. min: 1,
  39. minMessage: 'City must be at least {{ limit }} characters long',
  40. )]
  41. private string $city;
  42. private int $countryId = 72; // France's id
  43. #[Assert\Length(
  44. min: 10,
  45. minMessage: 'Phone number must be at least {{ limit }} characters long',
  46. )]
  47. private string $phone;
  48. #[Assert\Length(
  49. min: 10,
  50. minMessage: 'Mobile phone number must be at least {{ limit }} characters long',
  51. )]
  52. private ?string $mobile = null;
  53. #[Assert\Email(
  54. message: 'The email {{ value }} is not a valid email.',
  55. )]
  56. private string $email;
  57. private ?\DateTimeInterface $creationDate = null;
  58. private ?int $authorId = null;
  59. public function getUsername(): string
  60. {
  61. return $this->username;
  62. }
  63. public function setUsername(string $username): self
  64. {
  65. $this->username = $username;
  66. return $this;
  67. }
  68. public function getGender(): GenderEnum
  69. {
  70. return $this->gender;
  71. }
  72. public function setGender(GenderEnum $gender): self
  73. {
  74. $this->gender = $gender;
  75. return $this;
  76. }
  77. public function getName(): string
  78. {
  79. return $this->name;
  80. }
  81. public function setName(string $name): self
  82. {
  83. $this->name = $name;
  84. return $this;
  85. }
  86. public function getGivenName(): string
  87. {
  88. return $this->givenName;
  89. }
  90. public function setGivenName(string $givenName): self
  91. {
  92. $this->givenName = $givenName;
  93. return $this;
  94. }
  95. public function getStreetAddress1(): string
  96. {
  97. return $this->streetAddress1;
  98. }
  99. public function setStreetAddress1(string $streetAddress1): self
  100. {
  101. $this->streetAddress1 = $streetAddress1;
  102. return $this;
  103. }
  104. public function getStreetAddress2(): ?string
  105. {
  106. return $this->streetAddress2;
  107. }
  108. public function setStreetAddress2(?string $streetAddress2): self
  109. {
  110. $this->streetAddress2 = $streetAddress2;
  111. return $this;
  112. }
  113. public function getStreetAddress3(): ?string
  114. {
  115. return $this->streetAddress3;
  116. }
  117. public function setStreetAddress3(?string $streetAddress3): self
  118. {
  119. $this->streetAddress3 = $streetAddress3;
  120. return $this;
  121. }
  122. public function getPostalCode(): string
  123. {
  124. return $this->postalCode;
  125. }
  126. public function setPostalCode(string $postalCode): self
  127. {
  128. $this->postalCode = $postalCode;
  129. return $this;
  130. }
  131. public function getCity(): string
  132. {
  133. return $this->city;
  134. }
  135. public function setCity(string $city): self
  136. {
  137. $this->city = $city;
  138. return $this;
  139. }
  140. public function getCountryId(): int
  141. {
  142. return $this->countryId;
  143. }
  144. public function setCountryId(int $countryId): self
  145. {
  146. $this->countryId = $countryId;
  147. return $this;
  148. }
  149. public function getPhone(): string
  150. {
  151. return $this->phone;
  152. }
  153. public function setPhone(string $phone): self
  154. {
  155. $this->phone = $phone;
  156. return $this;
  157. }
  158. public function getMobile(): ?string
  159. {
  160. return $this->mobile;
  161. }
  162. public function setMobile(?string $mobile): self
  163. {
  164. $this->mobile = $mobile;
  165. return $this;
  166. }
  167. public function getEmail(): string
  168. {
  169. return $this->email;
  170. }
  171. public function setEmail(string $email): self
  172. {
  173. $this->email = $email;
  174. return $this;
  175. }
  176. public function getCreationDate(): ?\DateTimeInterface
  177. {
  178. return $this->creationDate;
  179. }
  180. public function setCreationDate(?\DateTimeInterface $creationDate): self
  181. {
  182. $this->creationDate = $creationDate;
  183. return $this;
  184. }
  185. public function getAuthorId(): ?int
  186. {
  187. return $this->authorId;
  188. }
  189. public function setAuthorId(?int $authorId): self
  190. {
  191. $this->authorId = $authorId;
  192. return $this;
  193. }
  194. }