-
-
Notifications
You must be signed in to change notification settings - Fork 900
[GraphQL] kernel.view event never fired #2167
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
Comments
It's unfortunately a known issue. There is currently no event system for GraphQL.
I'll work on this ASAP, but any help is welcome if someone want to handle this before I do it :) |
Hmm I see, thanks for the quick response. Some thought on this:
I've made a very simple implementation here: master...jamesisaac:graphql-events which I think is enough to get what I need in my project (still listening to the old style REST events, as well as GraphQL dispatching a new event that shares a similiar interface). But I don't think I'm familiar enough with API Platform's codebase to know how you'd really want those events designed / where exactly they should be dispatched from, sadly. |
@dunglas do you have any update on this maybe? |
@dunglas Do you think this is solved now with the GraphQL Stages (and we could close this issue)? |
Yes you're right! Solved by https://api-platform.com/docs/core/extending/ too. |
The API Platform Event System Documentation lists many places in the request/response cycle you may want to attach your own listeners, the majority of them on
kernel.view
. This usesGetResponseForControllerResultEvent
which is a helpful event, as you can do some useful things with the controller result. I've had good results adding some business logic to my API here (e.g. advanced authorization, sending out automated emails).However in my experiments with using GraphQL, the
kernel.view
event doesn't seem to be getting fired for either queries or mutations?Is this intentional? This makes it hard to offer a dual REST/GraphQL API that offers the same behaviour when similar actions are performed...?
Symfony: 4.0
API Platform: 2.2.8
The text was updated successfully, but these errors were encountered: