Graphqlbundle: PHP way of declaring Resolvers with methods doesn't work in 0.12

Created on 17 Sep 2019  路  4Comments  路  Source: overblog/GraphQLBundle

| Q | A
| ---------------- | -----
| Bug report? | yes
| Feature request? | no
| BC Break report? | yes
| RFC? | no
| Version/Branch | 0.12.2

Hello, I have been using version ^0.11.0 in production for long time and i've tried updating to 0.12.2 but now my code throws:
Overblog\GraphQLBundle\Resolver\UnresolvableException: Unknown resolver with alias "App\GraphQL\Resolver\TestResolver::test" (verified service tag)[0] (caught throwable)

According to 0.12.2 docs we can still use this way of declaring resolvers

Example using a fully qualified method name:
resolve: '@=resolver("App\\GraphQL\\Resolver\\Greetings::sayHello", [args["name"]])'

Here is a example repo with steps to reproduce:
https://github.com/Vodzo/graphql-bug-demo

git clone https://github.com/Vodzo/graphql-bug-demo
cd graphql-bug-demo
composer install
bin/console graphql:debug

This is the output for 0.12.2:

GraphQL Resolvers Services
==========================

 ------------------------------------------------------------------------------ --------------------------------
  solution id                                                                    aliases
 ------------------------------------------------------------------------------ --------------------------------
  App\GraphQL\Resolver\TestResolver
  Overblog\GraphQLBundle\GraphQL\Relay\Mutation\MutationFieldResolver            relay_mutation_field
  Overblog\GraphQLBundle\GraphQL\Relay\Node\GlobalIdFieldResolver                relay_globalid_field
  Overblog\GraphQLBundle\GraphQL\Relay\Node\NodeFieldResolver                    relay_node_field
  Overblog\GraphQLBundle\GraphQL\Relay\Node\PluralIdentifyingRootFieldResolver   relay_plural_identifying_field
 ------------------------------------------------------------------------------ --------------------------------

It should be:
App\GraphQL\Resolver\TestResolver::test
instead of
App\GraphQL\Resolver\TestResolver

If i downgrade back to 0.11 this is the output:

GraphQL Resolvers Services
==========================

 ------------------------------------------------------------------------------ --------------------------------
  solution id                                                                    aliases
 ------------------------------------------------------------------------------ --------------------------------
  App\GraphQL\Resolver\TestResolver::test
  Overblog\GraphQLBundle\GraphQL\Relay\Mutation\MutationFieldResolver            relay_mutation_field
  Overblog\GraphQLBundle\GraphQL\Relay\Node\GlobalIdFieldResolver                relay_globalid_field
  Overblog\GraphQLBundle\GraphQL\Relay\Node\NodeFieldResolver                    relay_node_field
  Overblog\GraphQLBundle\GraphQL\Relay\Node\PluralIdentifyingRootFieldResolver   relay_plural_identifying_field
 ------------------------------------------------------------------------------ --------------------------------

Hope you can look into it. Thanks

bug

Most helpful comment

Hi @mcg-web. Thanks for a quick response.

Tested it and its working. Thanks 馃憤

All 4 comments

I can confirm this.

Hi @Vodzo the bug was fixed on 0.12@dev can you confirm it's ok for you? We'll release a new patch in coming days if this is the case. Thank you :+1:

Hi @mcg-web. Thanks for a quick response.

Tested it and its working. Thanks 馃憤

Thanks again for feedback! Here is the new release with the patch v0.12.3.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VincentClair picture VincentClair  路  4Comments

tjuenger picture tjuenger  路  3Comments

JuanWilde picture JuanWilde  路  4Comments

paoloposo picture paoloposo  路  3Comments

akomm picture akomm  路  4Comments