joaogarin / mydrupalgql

7 stars 3 forks source link

ResolverRegistry::__construct() no longer accepts array #2

Open Kwadz opened 5 years ago

Kwadz commented 5 years ago

After a fresh install of Drupal 8, GraphQL module v4 and mydrupalgql, on the following query:

mutation {
  createArticle(data: {title: "Hello GraphQl 2"}) {
    ... on Article {
      id
      title
    }
  }
}

We get:

[php7:notice] [pid 10124] [client 127.0.0.1:49288] TypeError: Argument 1 passed to Drupal\\graphql\\GraphQL\\ResolverRegistry::__construct() must be callable or null, array given, called in /Users/myuser/sites/drupal8/modules/custom/mydrupalgql/src/Plugin/GraphQL/Schema/SdlSchemaMyDrupalGql.php on line 97 in /Users/myuser/sites/drupal8/modules/contrib/graphql/src/GraphQL/ResolverRegistry.php on line 56 #0

The following arguments provided in ResolverRegistry constructor in SdlSchemaMyDrupalGql::getResolverRegistry are not required anymore since https://github.com/drupal-graphql/graphql/pull/821:

$registry = new ResolverRegistry([
  'Article' => ContextDefinition::create('entity:node')
    ->addConstraint('Bundle', 'article'),
  'Page' => ContextDefinition::create('entity:node')
    ->addConstraint('Bundle', 'page'),
]);

In the examples provided in the GraphQL module, the constructor is empty.

Kwadz commented 5 years ago

Just in case, I mention that this repository is provided as an example in the documentation.