1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace Drupal\materio_graphql\Plugin\GraphQL\Schema;
- use Drupal\graphql\Plugin\GraphQL\Schema\ComposableSchema;
- use Drupal\graphql\GraphQL\ResolverBuilder;
- use Drupal\graphql\GraphQL\ResolverRegistry;
- // use Drupal\graphql\Plugin\GraphQL\Schema\SdlSchemaPluginBase;
- use GraphQL\Error\Error;
- /**
- * @Schema(
- * id = "materio",
- * name = "Materio schema",
- * extensions = "materio",
- * )
- */
- class MaterioSchema extends ComposableSchema {
- // /**
- // * {@inheritdoc}
- // */
- // public function getResolverRegistry() {
- // $builder = new ResolverBuilder();
- // $registry = new ResolverRegistry();
- //
- // // Tell GraphQL how to resolve types of a common interface.
- // $registry->addTypeResolver('NodeInterface', function ($value) {
- // if ($value instanceof NodeInterface) {
- // switch ($value->bundle()) {
- // case 'article': return 'Article';
- // case 'materiau': return 'Materiau';
- // }
- // }
- // throw new Error('Could not resolve content type.');
- // });
- //
- // $registry->addFieldResolver('Query', 'route', $builder->compose(
- // $builder->produce('route_load')
- // ->map('path', $builder->fromArgument('path')),
- // $builder->produce('route_entity')
- // ->map('url', $builder->fromParent())
- // ));
- //
- // return $registry;
- // }
- }
|