-
-
Notifications
You must be signed in to change notification settings - Fork 892
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
[GraphQL] Embedded resources does not work for mutations #3258
Comments
It's a known issue. More info here: #1964 and here: #1886. |
Is this issue appears only with One-To-Many relation types? I am trying to understand how to get graphql schema with embedded input type for One-To-One relation. And I see that the result just the same. For example, if we have two entities: User and UserProfile defined as
Then I expect that the profile field in updateUserInput will be type of updateUserProfileInput but in generated schema I get this type
Is it correct? Is there a way to update both User and it's profile in one mutation? |
Found this #1750 Is it still unsupported? |
Are there any workarounds for this? E.g. can I implement the persisting logic manually? This is currently a pretty huge limitation. Multiple requests work, but they are very fragile. Partial failure (one of the N requests fails) makes it impossible to revert to the previous state. The only way around this is de-normalizing my database but that's also a pretty major drawback. Edit: This can be implemented manually, should've searched the docs before. https://api-platform.com/docs/core/graphql/#custom-mutations Either way, it would be nice if this didn't require manual intervention. |
See https://api-platform.com/docs/main/core/graphql/#embedded-relation-input-creation-of-relation-in-mutation for a way to solve this issue. |
@alanpoulain Thank you! (Unfortunately?) I switched from GraphQL to Rest after a few days. Nested selects can easily be done with the |
Any update ? |
embedded resource does not work for query as well |
API Platform version(s) affected: 2.5.1
Description
When resources are defined in yaml instead of Doctrine GraphQL will not show them as embedded resources for mutations.
The schema definition
And serialization config
Will create the following
createBookInput
object in graphqlHow to reproduce
Additional Context
Similar to these issues but @alanpoulain suggested that they are likely not the same.
The text was updated successfully, but these errors were encountered: