mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
BasicEntityPersister::expandParameters() expands criteria parameters with custom types wrong
#6871
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bravik on GitHub (Nov 10, 2021).
BC Break Report
Summary
Short version:
expandParametersmethod does unwanted conversion of object with custom Doctrine type to plain value, which DBAL later tries to convert again during query execution and fails, because it expects an object. So double conversion happensLong version:
I have a value object for
Id(and actually a lot of other value objects):For it I have a custom Doctrine type
IdType:which is used in entities:
In one of my repositories I have:
Which worked fine, until orm silently updated dbal to version 3.
Now,
findOneByfails to retrieve values.My investigation led me to
BasicEntityPersister::expandParameters()method.8336420a26/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php (L1817)8336420a26/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php (L1828)This method retuns
[$params, $types]and passes to dbal to execute query.In my particular case it should return
Previous behavior
Current behavior
But it actually converts my Id object to plain value and returns:
Then query is executed and DBAL is trying to convert plain
1value toidtype (seeIdType) and it fails