|
2 | 2 |
|
3 | 3 | namespace Drupal\graphql_core\Plugin\GraphQL\Schemas; |
4 | 4 |
|
5 | | -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; |
6 | 5 | use Drupal\graphql\Plugin\GraphQL\Schemas\SchemaPluginBase; |
7 | | -use Symfony\Component\DependencyInjection\ContainerInterface; |
8 | | -use Youshido\GraphQL\Config\Schema\SchemaConfig; |
9 | | -use Youshido\GraphQL\Schema\InternalSchemaMutationObject; |
10 | | -use Youshido\GraphQL\Schema\InternalSchemaQueryObject; |
11 | 6 |
|
12 | 7 | /** |
13 | 8 | * Default generated schema. |
14 | 9 | * |
15 | 10 | * @GraphQLSchema( |
16 | 11 | * id = "default", |
17 | 12 | * name = "Default", |
18 | | - * path = "/graphql" |
| 13 | + * path = "/graphql", |
| 14 | + * builder = "\Drupal\graphql\Plugin\GraphQL\PluggableSchemaBuilder" |
19 | 15 | * ) |
20 | 16 | */ |
21 | | -class DefaultSchema extends SchemaPluginBase implements ContainerFactoryPluginInterface { |
| 17 | +class DefaultSchema extends SchemaPluginBase { |
22 | 18 |
|
23 | | - /** |
24 | | - * {@inheritdoc} |
25 | | - */ |
26 | | - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { |
27 | | - /** @var \Drupal\graphql\Plugin\GraphQL\SchemaBuilderFactory $schemaBuilderFactory */ |
28 | | - $schemaBuilderFactory = $container->get('graphql.schema_builder_factory'); |
29 | | - // TODO: Inject schema reducer configuration into the schema builder. |
30 | | - $schemaBuilder = $schemaBuilderFactory->getSchemaBuilder(); |
31 | | - |
32 | | - $mutation = new InternalSchemaMutationObject(['name' => 'RootMutation']); |
33 | | - |
34 | | - $query = new InternalSchemaQueryObject(['name' => 'RootQuery']); |
35 | | - $query->addFields($schemaBuilder->getRootFields()); |
36 | | - |
37 | | - $types = $schemaBuilder->find(function() { |
38 | | - return TRUE; |
39 | | - }, [ |
40 | | - GRAPHQL_UNION_TYPE_PLUGIN, |
41 | | - GRAPHQL_TYPE_PLUGIN, |
42 | | - GRAPHQL_INPUT_TYPE_PLUGIN, |
43 | | - ]); |
44 | | - |
45 | | - $schema = [ |
46 | | - 'query' => $query, |
47 | | - 'mutation' => $mutation, |
48 | | - 'types' => $types, |
49 | | - ]; |
50 | | - |
51 | | - return new static( |
52 | | - $configuration + ['schema' => $schema], |
53 | | - $plugin_id, |
54 | | - $plugin_definition |
55 | | - ); |
56 | | - } |
57 | | - |
58 | | - /** |
59 | | - * {@inheritdoc} |
60 | | - */ |
61 | | - protected function constructSchema($configuration, $pluginId, $pluginDefinition) { |
62 | | - $this->config = new SchemaConfig($configuration['schema']); |
63 | | - } |
64 | 19 | } |
0 commit comments