TypeOfPracticeTree.php 938 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\ApiResources\Tree;
  4. use ApiPlatform\Metadata\ApiProperty;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Get;
  7. use App\Service\Utils\Tree\BaseResourceTree;
  8. use App\Service\Utils\Tree\ResourceTreeInterface;
  9. use App\State\Provider\Tree\TypeOfPracticeTreeProvider;
  10. #[ApiResource(
  11. operations: [
  12. new Get(
  13. uriTemplate: '/tree/type_of_practices',
  14. ),
  15. ],
  16. provider: TypeOfPracticeTreeProvider::class,
  17. )]
  18. class TypeOfPracticeTree extends BaseResourceTree implements ResourceTreeInterface
  19. {
  20. /**
  21. * Id 'bidon' ajouté par défaut pour permettre la construction
  22. * de l'IRI par api platform.
  23. */
  24. #[ApiProperty(identifier: true)]
  25. private int $id = 1;
  26. public function getId(): int
  27. {
  28. return $this->id;
  29. }
  30. public function setId(int $id): self
  31. {
  32. $this->id = $id;
  33. return $this;
  34. }
  35. }