In my Symfony project I am using \Ramsey\Uuid\Uuid
library for persisting user object with unique uuid.
$user->setUUid(Uuid::uuid4());
No I want to search for an user object by that uuid like:
$uuid = $this->userRepo->findOneBy(['uuid' => $uuid]);
And I am passing it trough my request like:
http://localhost:8080/api/user/039ade1a-c111-419c-9904-67b62162208
but I get:
"Could not convert database value "039ade1a-c111-419c-9..." to Doctrine Type uuid"
Should I somehow convert it again to uuid?
I tried:
return $this->createQueryBuilder('p')
->where('p.uuid = :uuid')
->setParameters(
'uuid' => Uuid::fromString($uuid)->getBytes()
)
->getQuery()
->getOneOrNullResult();
Error still the same.