-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Failing inverse One-to-One relationship using a custom data type #5887
Comments
Can someone please have a look into this bug. I would look into myself but will probably end up breaking stuff!!! |
I came across this bug and while debugging I found following line:
Keys of After changing previously mentioned line to:
Which results in keys being in the form of mapped class field name and in I did not test this heavily but it works for the case with which I had trouble but as I never worked with doctrine source code it would be best if someone took a look at it. I'll try creating pull request for this over the weekend but if someone wants to do it sooner feel free. |
…om-id-object-relationship-fix Fixing #5887 - lazy loading of one-to-one relationship with custom id object
I'm afraid this has implications on bidirectional one-to-one relations with multiple JoinColumns: #7579 |
Issue
The BasicEntityPersister, possibly loadOneToOneEntity() method, does not handle One-to-One relationships on the inverse side when using a custom data type.
I've stepped through the code and can see that getTypes() method is failing to find a mapping due to the SQL field name being passed in rather than the class field. E.g. from the example below its "t0.shipping_id" but I think should be "shipping". Unfortunately my understanding of the internals of Doctrine is not enough to spot the exact cause / place to fix.
Steps to reproduce
Create two classes with a one-to-one relationship using a custom data type. I used the Ramsey UUID library and Doctrine integration.
Create DQL that filters based on the inverse side and not that hydrated object returned has NULL for the relationship.
Filtering on owning side or using entityManager-find('Shipping', $id) both work correctly.
If I can give any more information or perform any tests please don't hesistate to ask.
Versions
doctrine/common v2.5.3
doctrine/dbal v2.5.4
doctrine/doctrine-module 1.0.0
doctrine/doctrine-orm-module 0.10.0
doctrine/orm v2.5.4
ramsey/uuid-doctrine 1.2.0
YAML mappings
Working Example - Owning Side
SQL Generated
Broken Example - Inverse side
SQL Generated
Note: shipping_id is using the string representation not database value.
Thanks a lot for any help / advice or even a suggested bug fix.
Alex
The text was updated successfully, but these errors were encountered: