-
-
Notifications
You must be signed in to change notification settings - Fork 946
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
OneToMany relation when using custom identifier in GraphQL returns null/wrong data #1542
Comments
Indeed there is something wrong with IRI converter, referencing Custom identifier and subresources, not just docs issue but it works when you pass real ID in url.
Test Cases:
So there's bug in DataProvider which do not convert IRI;s to proper internal ID's and query with code directly. Shouldn't it be checking and getting item first and then passing right identifier to doctrine in the first place? Here is relevant query from data provider which clearly passes
|
Related? api-platform/core#3585 |
Changing Update:
|
Thanks for your investigation @mxmp210 ! Could you open a PR for this? |
@soyuka Sure I'd love to, First it needs to be tested for nested subresources as well, in theory it should work but just to make sure it won't break in the future. Are there any built-in tests that which can be performed out-of-box for the usecase? Sorry this would be my first PR, little help required here. |
@itsmitul This issue was resolved in later versions, seems it's safe to close. |
API Platform version(s) affected: 2.5.6
Description
When using custom identifier that is not a primary key, OneToMany result set returns null or wrong data. This issue is caused because when fetching data from OneToMany table, the custom identifier value is used instead of primary key.
How to reproduce
Table Blog has a custom identifier
slug
and primary keyid
. This table have a OneToMany relationship with Table ImageThese are the queries made while fetching data:
While fetching from image , Blog ID should be sent in parameters but slug is used.
However, things are working fine in REST.
Update: Works fine in 2.5.4
The text was updated successfully, but these errors were encountered: