Skip to content

The Fragment example produces an error: Invalid method query in src/Entities/Fragment.php:49 #33

@MurzNN

Description

@MurzNN

When I copy-paste the Fragment example from the readme:

$fragment = new GraphQL\Entities\Fragment('properties', 'Hero');
$fragment->use('id', 'age');
$hero = new \GraphQL\Actions\Query('hero');
echo $hero->use('name', $fragment)->query();
echo $fragment->query();

it throws an error:

fragment properties on Hero {
    id
    age
}
{
    ()
    {
        name
        ...properties
    }
}PHP Fatal error:  Uncaught GraphQL\Exceptions\InvalidMethodException: Invalid method query in /var/www/html/vendor/graphql/src/Entities/Fragment.php:49
Stack trace:
#0 /var/www/html/vendor/graphql/src/tests.php(12): GraphQL\Entities\Fragment->__call('query', Array)
#1 {main}
  thrown in /var/www/html/vendor/graphql/src/Entities/Fragment.php on line 49

Fatal error: Uncaught GraphQL\Exceptions\InvalidMethodException: Invalid method query in /var/www/html/vendor/graphql/src/Entities/Fragment.php on line 49

GraphQL\Exceptions\InvalidMethodException: Invalid method query in /var/www/html/vendor/graphql/src/Entities/Fragment.php on line 49

Call Stack:
    0.0004     491928   1. {main}() /var/www/html/vendor/graphql/src/tests.php:0
    0.0141     723272   2. GraphQL\Entities\Fragment->__call($method = 'query', $arguments = []) /var/www/html/vendor/graphql/src/tests.php:12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions