Skip to content
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

[Feat] allow omitting resolver alias in tag config #134

Closed
akomm opened this issue Apr 24, 2017 · 4 comments
Closed

[Feat] allow omitting resolver alias in tag config #134

akomm opened this issue Apr 24, 2017 · 4 comments

Comments

@akomm
Copy link
Member

akomm commented Apr 24, 2017

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Version/Branch 0.7.1

When omitting alias for an resolver would implicitly set the alias to be equal the service class name, combined with this feature request, a lot of boilerplate configuration could be saved using a bundle like DunglasActionBundle. You would not need to configure any resolver services at all, as long as you implement a single resolve function per class (__invoke).

mcg-web added a commit to mcg-web/GraphQLBundle that referenced this issue Apr 24, 2017
Allow omitting resolver and mutation method in tag config overblog#134
@mcg-web
Copy link
Member

mcg-web commented Apr 24, 2017

Ok I understand the need, is true that the bundle require a lot of configuration, we must work on a flow to ease resolvers and mutations definitions.... In first step i added #133.

@akomm
Copy link
Member Author

akomm commented Apr 24, 2017

I was about checking out to make a PR, this was the fastest reaction I ever experienced!

AppBundle\GraphQL\Resolver\WorkflowsResolver:
    class: AppBundle\GraphQL\Resolver\WorkflowsResolver
    tags:
      - { name: overblog_graphql.resolver, method: '__invoke', alias: 'AppBundle\GraphQL\Resolver\WorkflowsResolver' }

Should be defaulted from:

services:
  AppBundle\GraphQL\Resolver\WorkflowsResolver:
    class: AppBundle\GraphQL\Resolver\WorkflowsResolver
    tags:
      - { name: overblog_graphql.resolver }

This could be the default behavior without BC break. And with some extras, like the DunlasActionBundle it would be possible to auto-tag & wire so you don`t even need to provide this. I think it should not be be tied to another bundle, but it saves already boilerplate without. The usage of the bundle can be proposed in docs as a best practice to even save more, if you agree.

  • Resolver/Mutation services become thin. They do not handle 100 different resolves/mutations: Concern separation.
  • You don't have to write the config for resolver/mutation services.
  • It is all compile time

@mcg-web
Copy link
Member

mcg-web commented Apr 24, 2017

This is awesome! Implementing this could helps win a lot of time. DunglasActionBundle is a good example...

@mcg-web
Copy link
Member

mcg-web commented May 3, 2017

This feature has been added to master (release will comes later), here the doc. Thanks again for the idea 👍

@mcg-web mcg-web closed this as completed May 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants