Using:
- PostgreSQL 11 with
uuid_generate_v4
type - Symfony 4.4.11
- Api Platform 2.5.6
I have an Entity with the following Id :
/** * @ORM\Entity(repositoryClass="App\Repository\ContractRepository") * @ORM\HasLifecycleCallbacks */class Contract{ /** * @ORM\Id() * @ORM\GeneratedValue(strategy="UUID") * @ORM\Column(name="id", type="guid", unique=true) */ private $id;[...]
I generate the following route with Api Platform :
App\Entity\Contract: itemOperations: get:
So I get a generated route like /contracts/{id}
Currently, if I do /contracts/TEST
, it will try to do the SQL request with "TEST" in a where clause and so will fail as a 500
.
I would like to prevent this behaviour by asserting that the {id}
parameter is a UUID_v4
and return a 400
if not.