AdminAccess.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. declare (strict_types=1);
  3. namespace App\ApiResources\Access;
  4. use ApiPlatform\Metadata\Put;
  5. use ApiPlatform\Metadata\Get;
  6. use ApiPlatform\Metadata\ApiResource;
  7. use ApiPlatform\Metadata\ApiProperty;
  8. use App\ApiResources\ApiResourcesInterface;
  9. use App\State\Processor\Access\AdminAccessProcessor;
  10. use App\State\Provider\Access\AdminAccessProvider;
  11. use JetBrains\PhpStorm\Pure;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. /**
  14. * Classe resource qui contient les champs d'un compte admin
  15. */
  16. #[ApiResource]
  17. class AdminAccess implements ApiResourcesInterface
  18. {
  19. #[ApiProperty(identifier: true)]
  20. public ?int $id = null;
  21. private ?string $username = null;
  22. #[Assert\Email(message: 'invalid-email-format', mode: 'strict')]
  23. private ?string $email = null;
  24. #[Pure]
  25. public function __construct()
  26. {
  27. }
  28. public function getId() : ?int
  29. {
  30. return $this->id;
  31. }
  32. public function setId(?int $id) : self
  33. {
  34. $this->id = $id;
  35. return $this;
  36. }
  37. public function getUsername() : ?string
  38. {
  39. return $this->username;
  40. }
  41. public function setUsername(?string $username) : self
  42. {
  43. $this->username = $username;
  44. return $this;
  45. }
  46. public function getEmail() : ?string
  47. {
  48. return $this->email;
  49. }
  50. public function setEmail(?string $email) : self
  51. {
  52. $this->email = $email;
  53. return $this;
  54. }
  55. }