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

Injection of ResolveInfo into auto-guessed & arguments transformer #728

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Injection of ResolveInfo into auto-guessed & arguments transformer #728

wants to merge 2 commits into from

Conversation

Vincz
Copy link
Collaborator

@Vincz Vincz commented Aug 13, 2020

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Documented? yes
License MIT

This PR adds a way to inject the ResolveInfo through the Argument Transformers and will be able to auto-guessed it based on the class GraphQL\Type\Definition\ResolveInfo.

Usage example with auto-guessing:

/**
 * @GQL\Type
 */
class MyType {
    /**
     * @GQL\Field(type="[String]!")
     */
    public function getSomething(int $amount, ResolveInfo $info) {
        ...
    }
}

Usage example with @Arg

/**
 * @GQL\Type
 */
class RootQuery {
    /**
     * @GQL\Field(
     *   type="[User]",
     *   args={
     *     @GQL\Arg(name="ids", type="[Int]"),
     *     @GQL\Arg(name="info", type="@info")
     *   },
     *   resolve="@=call(service('UserRepository').getUser, arguments({ids: '[Int]', info: '@info'}, arg))"
     * )
     */
    public $getUsers;
}

@Vincz Vincz requested review from murtukov and mcg-web August 13, 2020 11:42
@mcg-web
Copy link
Member

mcg-web commented Aug 13, 2020

hi Vinc with the Resolver definition enhancement #708 this PR could be totally obsolete since the way how resolver works has been completely rewritten to be more like a Symfony Controller. Can we wait until before merging this? So we can make annotations takes benefit of this new feature.

@Vincz
Copy link
Collaborator Author

Vincz commented Aug 13, 2020

hi Vinc with the Resolver definition enhancement #708 this PR could be totally obsolete since the way how resolver works has been completely rewritten to be more like a Symfony Controller. Can we wait until before merging this? So we can make annotations takes benefit of this new feature.

Yes, you are right, I forgot about it. No problem, we will merge it later only if it is still relevant.
I was also about to work on a way to extend the auto-guessing (to manage case like : #694), but it's the same and will probably not be relevant after the resolver refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants