src/Entity/SpNpSettlements.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\SpNpSettlementsRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use ApiPlatform\Metadata\ApiFilter;
  8. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  9. #[ORM\Entity(repositoryClassSpNpSettlementsRepository::class)]
  10. #[ApiResource(
  11.     normalizationContext: ['groups' => ['sp_np:read']],
  12.     denormalizationContext: ['groups' => ['sp_np:write']],
  13.     order: ['name' => 'ASC']
  14. )]
  15. #[ApiFilter(SearchFilter::class, properties: [
  16.     'ref' => 'exact'
  17.     'name' => 'ipartial' 
  18. ])]
  19. class SpNpSettlements
  20. {
  21.     #[Groups(['sp_np:read''sp_np:write''sp:read'])]
  22.     #[ORM\Id]
  23.     #[ORM\GeneratedValue]
  24.     #[ORM\Column]
  25.     private ?int $id null;
  26.     #[Groups(['sp_np:read''sp_np:write''sp:read'])]
  27.     #[ORM\Column(length255nullabletrue)]
  28.     private ?string $name null;
  29.     #[Groups(['sp_np:read''sp_np:write''sp:read'])]
  30.     #[ORM\Column(length255nullabletrue)]
  31.     private ?string $area null;
  32.     #[Groups(['sp_np:read''sp_np:write''sp:read'])]
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $ref null;
  35.     #[Groups(['sp_np:read''sp_np:write''sp:read'])]
  36.     #[ORM\Column(nullabletrue)]
  37.     private ?array $object null;
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getName(): ?string
  43.     {
  44.         return $this->name;
  45.     }
  46.     public function setName(?string $name): static
  47.     {
  48.         $this->name $name;
  49.         return $this;
  50.     }
  51.     public function getArea(): ?string
  52.     {
  53.         return $this->area;
  54.     }
  55.     public function setArea(?string $area): static
  56.     {
  57.         $this->area $area;
  58.         return $this;
  59.     }
  60.     public function getRef(): ?string
  61.     {
  62.         return $this->ref;
  63.     }
  64.     public function setRef(?string $ref): static
  65.     {
  66.         $this->ref $ref;
  67.         return $this;
  68.     }
  69.     public function getObject(): ?array
  70.     {
  71.         return $this->object;
  72.     }
  73.     public function setObject(?array $object): static
  74.     {
  75.         $this->object $object;
  76.         return $this;
  77.     }
  78. }