Country.php 1014 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Core;
  4. use ApiPlatform\Metadata\ApiResource;
  5. use ApiPlatform\Metadata\Get;
  6. use ApiPlatform\Metadata\GetCollection;
  7. use App\Repository\Core\CountryRepository;
  8. // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * Pays.
  12. */
  13. #[ApiResource(
  14. operations: [
  15. new Get(),
  16. new GetCollection(),
  17. ],
  18. paginationEnabled: false
  19. )]
  20. // #[Auditable]
  21. #[ORM\Entity(repositoryClass: CountryRepository::class)]
  22. #[ORM\Table]
  23. #[ORM\Index(name: 'name_idx', columns: ['name'])]
  24. class Country
  25. {
  26. #[ORM\Id]
  27. #[ORM\Column]
  28. #[ORM\GeneratedValue]
  29. private ?int $id = null;
  30. #[ORM\Column(length: 255)]
  31. private string $name;
  32. public function getId(): ?int
  33. {
  34. return $this->id;
  35. }
  36. public function getName(): string
  37. {
  38. return $this->name;
  39. }
  40. public function setName(string $name): self
  41. {
  42. $this->name = $name;
  43. return $this;
  44. }
  45. }