-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[GraphQL] Custom types, queries and mutations #830
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
Conversation
f95bf02 to
962199c
Compare
core/graphql.md
Outdated
| They are following the GraphQL type system. | ||
| If you don't define the `args` property, it will be the default ones (for example `id` for an item). | ||
|
|
||
| You can also note that: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note also that:?
dunglas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great feature! GraphQL support starts to be very convenient.
core/graphql.md
Outdated
| If you move forward, you'll end up having an empty result. | ||
|
|
||
| ## Mutations | ||
| ### Custom queries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### Custom queries | |
| ### Custom Queries |
core/graphql.md
Outdated
| } | ||
| ``` | ||
|
|
||
| ### Custom mutations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### Custom mutations | |
| ### Custom Mutations |
core/graphql.md
Outdated
|
|
||
| ### Custom mutations | ||
|
|
||
| Creating custom mutations is like creating the [custom queries](#custom-queries). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Creating custom mutations is like creating the [custom queries](#custom-queries). | |
| Creating custom mutations is like creating [custom queries](#custom-queries). |
| * | ||
| * @return Book | ||
| */ | ||
| public function __invoke($item, array $context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, iterable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the context? I think having an array is enough.
core/graphql.md
Outdated
| The GraphQL endpoint will be able to query only the name. It will only be able to create a book with an author. | ||
| When doing this mutation, the author of the created book will not be returned (the name will be instead). | ||
| ## Custom types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Custom types | |
| ## Custom Types |
core/graphql.md
Outdated
| To use it please [modify the extracted types](#modify-the-extracted-types) or use it directly in [custom queries](#custom-queries) or [custom mutations](#custom-mutations). | ||
| ## Modify the extracted types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Modify the extracted types | |
| ## Modifying the Extracted Types |
962199c to
7689bd2
Compare
|
I have been trying to add a custom query the way it is described in this PR. resolver: I expected this to just add an extra query, but what happens is that it completely removes all the default queries and mutations (create, update, delete) related to the Product entity and the inputs and payloads for them. Maybe I'm doing something wrong? |
|
Yes you need to add them too, like REST custom actions: https://api-platform.com/docs/core/operations/#recommended-method |
7689bd2 to
defa5df
Compare
defa5df to
502e790
Compare
No description provided.