mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
BC break in one-to-many relationship loading when using binary UUID (or custom) data type #7258
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 @sips-richard on GitHub (Nov 27, 2023).
BC Break Report
Summary
One of our micro-services exclusively uses binary UUIDs for all primary keys, using Ramsey's binary UUID data type. When using entity proxy method to fetch eager-loaded collection the UUID objects representing the primary keys are not appropriately converted with the configured data type and are instead implicitly converted to strings, such that when
executeQueryinloadAll(called byeagerLoadCollections) is run, the array of IDs in$paramsare string UUIDs and not the expected binary UUIDs. This causes no entities to be loaded in the collection.I've had a dig through the code and as far as I can tell
expandParametersis resolving the types (correctly) to102(array of strings), but not performing any type-specific conversion of values, and simply stringifying the UUID objects.Previous behavior
Prior to 2.17.0 the collection of related entities was correctly loaded.
Current behavior
Subsequent to the 2.17.0 changes the related entities are not loaded. See summary.
How to reproduce
Implement One-To-Many relationship using BinaryUuid data type (
ramsey/uuid-doctrine).@jennevdmeer commented on GitHub (Nov 28, 2023):
I think I have the same issue using Symfony's uid
Ulidas id's for related entry in my SF app. This was working on the 2.16.2 version.@dbannik commented on GitHub (Nov 28, 2023):
@jennevdmeer please remove "fetch=EAGER" and reproduce the problem
maybe the problem is similar to this one https://github.com/doctrine/orm/issues/11091
@frankverhoeven commented on GitHub (Nov 29, 2023):
Experiencing the same issue, and can indeed confirm that it is related to eager fetching a relation.
When removing the eager loading, the issue is gone.
@jennevdmeer commented on GitHub (Nov 29, 2023):
Well yes if I remove it they resolve one by one and it "works". Idk all these technical details seems like its the about the same thing? Regardless I'm not getting an error message as you described, my collections are just empty when having eager loading on (as was working before).
@beberlei commented on GitHub (Nov 30, 2023):
This needs to be fixed indeed, probably did not come up with the test suite as we don't test with the UUID type or similar things a lot
@aguerre commented on GitHub (Feb 8, 2024):
Any update ? Is it fixed or planned to be fixed in 3.0.0 or 2.18.0 ? I see the 2.17.x milestones for this issue but it's seems to be delayed regularly, so i'm wondering if i can update to 2.18.0 nor 3.0.0 directly
@ghost commented on GitHub (Mar 13, 2024):
I'm having this issue too. doctrine/orm 2.16.3 is the last version where I was unable to reproduce the issue.
I tried various releases since, all of which reproduce the issue:
@derrabus commented on GitHub (Mar 14, 2024):
This is fixed when someone fixes it. Could be you?
@BonBonSlick commented on GitHub (Mar 25, 2024):
I have
Doctrine\ORM\Mapping\ClassMetadata::getIdentifierValues(): Argument #1 ($entity) must be of type object, null given, called in /var/www/hint_api/vendor/doctrine/orm/src/UnitOfWork.php on line 2665
and I can verify messages above, 2.16 has no this issue.
Component is abstract class used as intermediate entitiy with inheritance type JOINED.
New ORM version crashes, downgrading solves error.
Error is caused inside vendor/doctrine/orm/src/Internal/Hydration/ObjectHydrator.php::138
Very likely the reason for that this BUG https://github.com/doctrine/orm/issues/11091
ThisImportant note, App\Domain\Core\Model\AbstractAnimeComponent is abstract class and we set up relation with non abstract class.
We have similar relations between NON abstract classes, and it seems to work fine:
So very probably it is somehow related how ORM works with inheritance structure. entities, abstract classes
@ghost commented on GitHub (Mar 25, 2024):
@BonBonSlick Which patch version of doctrine/orm 3.1 are you using? In my testing, 3.1.0 is broken but 3.1.1 was fixed.
Here's my latest testing of #11091 for the latest of each minor version branch:
@BonBonSlick commented on GitHub (Mar 26, 2024):
@amacrobert-meq yes, you were right 3.1.1 works fine, awesome!
Thanks!