OrganizationMemberCreationRequest.php 5.0 KB

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