Giter Club home page Giter Club logo

Comments (2)

lingo avatar lingo commented on June 20, 2024 1

I have found eventually that I can make this code work by adding the following code:

--- gqltest.php	2020-01-18 20:47:56.050542861 +1300
+++ gqltest2.php	2020-01-18 20:47:43.210501306 +1300
@@ -28,6 +28,11 @@
             ];
         },
     ],
+    'NamedNode' => [
+        '__resolveType' => function($item) {
+            return 'Test';
+        },
+    ],
 ]);
 
 $result = graphql($schema, $queryText);

I would suggest, then, that perhaps the error message, or else the documentation, is the real problem here. I was unable to find a reference to __resolveType in the documentation, but found this code in the test suite.

from graphql-php.

lingo avatar lingo commented on June 20, 2024

I've dumped the stack trace out from within graphql-php code, to try to resolve this issue.

-- Call to a member function getName() on null
#0 /var/www/html/vendor/digiaonline/graphql/src/Execution/Strategy/AbstractExecutionStrategy.php(764): Digia\GraphQL\Execution\Strategy\AbstractExecutionStrategy->buildLocatedError(Object(Error), Array, Array)
#1 /var/www/html/vendor/digiaonline/graphql/src/Execution/Strategy/AbstractExecutionStrategy.php(345): Digia\GraphQL\Execution\Strategy\AbstractExecutionStrategy->handleFieldError(Object(Error), Array, Array, Object(Digia\GraphQL\Type\Definition\InterfaceType))
#2 /var/www/html/vendor/digiaonline/graphql/src/Execution/Strategy/AbstractExecutionStrategy.php(219): Digia\GraphQL\Execution\Strategy\AbstractExecutionStrategy->completeValueCatchingError(Object(Digia\GraphQL\Type\Definition\InterfaceType), Array, Object(Digia\GraphQL\Execution\ResolveInfo), Array, Array)
#3 /var/www/html/vendor/digiaonline/graphql/src/Execution/Strategy/ParallelExecutionStrategy.php(34): Digia\GraphQL\Execution\Strategy\AbstractExecutionStrategy->resolveField(Object(Digia\GraphQL\Type\Definition\ObjectType), NULL, Array, Array)
#4 /var/www/html/vendor/digiaonline/graphql/src/Execution/Strategy/AbstractExecutionStrategy.php(125): Digia\GraphQL\Execution\Strategy\ParallelExecutionStrategy->executeFields(Object(Digia\GraphQL\Type\Definition\ObjectType), NULL, Array, Array)
#5 /var/www/html/vendor/digiaonline/graphql/src/Execution/Execution.php(90): Digia\GraphQL\Execution\Strategy\AbstractExecutionStrategy->execute()
#6 /var/www/html/vendor/digiaonline/graphql/src/Execution/Execution.php(53): Digia\GraphQL\Execution\Execution->executeOperation(NULL, Object(Digia\GraphQL\Execution\ExecutionContext), Object(Digia\GraphQL\Execution\Strategy\FieldCollector), Object(Digia\GraphQL\Execution\ValuesResolver))
#7 /var/www/html/vendor/digiaonline/graphql/src/GraphQL.php(266): Digia\GraphQL\Execution\Execution->execute(Object(Digia\GraphQL\Schema\Schema), Object(Digia\GraphQL\Language\Node\DocumentNode), NULL, NULL, Array, NULL, NULL, NULL)
#8 /var/www/html/vendor/digiaonline/graphql/src/api.php(151): Digia\GraphQL\GraphQL::execute(Object(Digia\GraphQL\Schema\Schema), Object(Digia\GraphQL\Language\Node\DocumentNode), NULL, NULL, Array, NULL, NULL, NULL)
#9 /var/www/html/vendor/digiaonline/graphql/src/GraphQL.php(335): Digia\GraphQL\execute(Object(Digia\GraphQL\Schema\Schema), Object(Digia\GraphQL\Language\Node\DocumentNode), NULL, NULL, Array, NULL, NULL, NULL)
#10 /var/www/html/vendor/digiaonline/graphql/src/api.php(199): Digia\GraphQL\GraphQL::process(Object(Digia\GraphQL\Schema\Schema), '{\n  test {\n    ...', NULL, NULL, Array, NULL, NULL, NULL)
#11 /var/www/html/gqltest.php(33): Digia\GraphQL\graphql(Object(Digia\GraphQL\Schema\Schema), '{\n  test {\n    ...')
#12 {main}⏎ 

from graphql-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.