-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PostgreSQL UUID type returns a binary stream; DB to PHP conversion is always null #225
Comments
Is the value returned from Postgres a |
I cannot tell with certainty if that is the case, I will check or make a poc for the issue. Sorry for the delayed reply, I have been traveling. |
Updates 😄 , finally. So I tried to reproduce my own report and I was failing at it. Most of the blame is on me, because while trying to debug this I changed so many things to "make it work", that I was convinced that my original report above reflected the truth. I followed the README of this project and just adapted to PSQL if necessary. Originally the project was using The This seems to be a specific issue when you combine a DB such as posgre and This is kind of a bug? I think README can be updated to make it more clear which type to use with which which platform, instead of having a comment hidden in a closed issue from 2018. Additionally the public function convertToPHPValue($value, AbstractPlatform $platform): ?UuidInterface
{
if ($platform instanceof PostgreSQLPlatform) {
throw new IncompatibleTypeAndPlatformException;
}
// ...
} Happy to help with either 👍 |
I faced the same issue triggering the following error:
I'm on PHP 8.2.12 with PostgreSQL 15.3 Adding the resource handling fixed my issue:
I am in favor of introducing resource handling for PostgreSQL and have submitted a PR #229. |
I created #230 to add clarify optimal use with PostgreSQL. |
Description
As mentioned in this comment for Postgre it is recommended to use
UuidType
instead ofUuidBinary
since the platform already has its own store-mechanism for UUIDs that is not a plainVARCHAR
.UuidType
when callingconvertToPHPValue
does not check for resource type, therefore setting the value always tonull
as it doesn't know what to do with it.Steps to reproduce
uuid
type for DBALExpected behaviour
UuidType when calling
convertToPHPValue
checks for resource type, in turn it is able to read bytes from Postgre and restore UUID string.Environment details
Additional context
I already have a local fix by adding the following:
I noticed though that PRs are stale for quite some time and thought to make an issue first. I also don't know if this to the liking of the contributors as a solution. Am happy to open a PR if there is feedback.
The text was updated successfully, but these errors were encountered: