4rthem / graphql-mapper-demo

A GraphQL Mapper demo
2 stars 0 forks source link

Demo not working for me #1

Open jmather opened 7 years ago

jmather commented 7 years ago

Hey! Hoping you can help.

I'm trying to get the demo up and running.

I've made a few minor changes to make things happier with postgres, but effectively still the same. Doctrine works fine. I can seed the database.

But when I get to making a call...

$ php -S localhost:8000
PHP 5.6.30 Development Server started at Mon Jul  3 09:48:10 2017
Listening on http://localhost:8000
Document root is /Users/jmather/code/php/graphql-mapper-demo
Press Ctrl-C to quit.
curl -XPOST 'http://localhost:8000/entry.php' -d 'query=query FooBar {
    luke: hero(episode: EMPIRE) {
        id,
        name,
        friends {
            id, name
        }
    },
    droid(id: "2001") {
        primaryFunction
    }
}'
[Mon Jul  3 09:48:36 2017] ::1:56052 [200]: /entry.php - Call to a member function addImplementation() on string in /Users/jmather/code/php/graphql-mapper-demo/vendor/webonyx/graphql-php/src/Type/Definition/InterfaceType.php on line 54

Tracing this down further, that code is:

    /**
     * Queue the update of the interfaces to know about this implementation.
     * This is an rare and unfortunate use of mutation in the type definition
     * implementations, but avoids an expensive "getPossibleTypes"
     * implementation for Interface types.
     *
     * @param ObjectType $impl
     */
    public static function addImplementationToInterfaces(ObjectType $impl)
    {
        self::$_lazyLoadImplementations[] = function() use ($impl) {
            /** @var self $interface */
            foreach ($impl->getInterfaces() as $interface) {
                $interface->addImplementation($impl); // here
            }
        };
    }

So what IS $interface, if it's not the InterfaceType we expect but a STRING?!

objecttype_php_-_graphql-mapper-demo_-____code_php_graphql-mapper-demo_

or viewed another way...

objecttype_php_-_graphql-mapper-demo_-____code_php_graphql-mapper-demo_

It looks like somewhere there's a conversion not happening. Any ideas?

jmather commented 7 years ago

The symfony demo throws the same error, and I even switched to mysql to ensure it wasn't that.

shabeer-ali-m commented 4 years ago

Same issue for me.. :( can anyone help ?