<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\CityGpvRepository;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
#[ORM\Entity(repositoryClass: CityGpvRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['read']],
denormalizationContext: ['groups' => ['write']],
)]
#[Get]
#[GetCollection]
#[ApiFilter(SearchFilter::class, properties: ['city' => 'partial'])]
class CityGpv
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['read'])]
private ?int $id = null;
#[ORM\Column(length: 45, nullable: true)]
#[Groups(['read'])]
private ?string $city = null;
public function getId(): ?int
{
return $this->id;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
}