From f6c5682de61b2d51f8820a11e5f9f6af9b6de618 Mon Sep 17 00:00:00 2001 From: Alexandr Viniychuk Date: Mon, 9 May 2016 09:25:13 -0400 Subject: [PATCH] updates for the simple installation --- Command/GenerateSchemaCommand.php | 4 ++-- Controller/GraphQLController.php | 5 +++-- DependencyInjection/Configuration.php | 2 +- DependencyInjection/GraphQLExtension.php | 4 ++-- Resources/config/services.yml | 7 +------ 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Command/GenerateSchemaCommand.php b/Command/GenerateSchemaCommand.php index d1a5d2e..708b481 100644 --- a/Command/GenerateSchemaCommand.php +++ b/Command/GenerateSchemaCommand.php @@ -1,6 +1,6 @@ setName('graphql:generate-schema') + ->setName('graphql:schema:generate') ->setDescription('Generates GraphQL Schema class') ->addArgument('bundle', InputArgument::REQUIRED, 'Bundle to generate class to'); } diff --git a/Controller/GraphQLController.php b/Controller/GraphQLController.php index 57955e1..c8a28ac 100644 --- a/Controller/GraphQLController.php +++ b/Controller/GraphQLController.php @@ -41,7 +41,8 @@ public function defaultAction() } $processor = $this->get('youshido.graphql.processor'); - if ($schemaClass = $this->getParameter('youshido.graphql.schema_class')) { + if ($this->container->hasParameter('youshido.graphql.schema_class')) { + $schemaClass = $this->getParameter('youshido.graphql.schema_class'); if (!class_exists($schemaClass)) { throw new ConfigurationException('Schema class ' . $schemaClass . ' does not exist'); } @@ -52,4 +53,4 @@ public function defaultAction() return new JsonResponse($processor->getResponseData(), 200, $this->getParameter('youshido.graphql.response_headers')); } -} \ No newline at end of file +} diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index f0b90a6..63200e6 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -23,7 +23,7 @@ public function getConfigTreeBuilder() $rootNode ->children() - ->scalarNode('query_schema')->cannotBeEmpty()->end() + ->scalarNode('schema_class')->cannotBeEmpty()->end() ->scalarNode('logger')->defaultValue(null)->end() ->arrayNode('response_headers') ->prototype('array') diff --git a/DependencyInjection/GraphQLExtension.php b/DependencyInjection/GraphQLExtension.php index 17504b2..bfd37b7 100644 --- a/DependencyInjection/GraphQLExtension.php +++ b/DependencyInjection/GraphQLExtension.php @@ -29,7 +29,7 @@ public function load(array $configs, ContainerBuilder $container) $responseHeaders[$responseHeader['name']] = $responseHeader['value']; } - $container->setParameter('youshido.graphql.project_schema', $this->getConfig('query_schema', null)); + $container->setParameter('youshido.graphql.schema_class', $this->getConfig('schema_class', null)); $container->setParameter('youshido.graphql.response_headers', $responseHeaders); $container->setParameter('youshido.graphql.logger', $this->getConfig('logger', null)); @@ -40,7 +40,7 @@ public function load(array $configs, ContainerBuilder $container) private function getDefaultHeaders() { return [ - ['name' => 'Access-Control-Allow-Origin', 'value' => '*'], + ['name' => 'Access-Control-Allow-Origin', 'value' => '*'], ]; } diff --git a/Resources/config/services.yml b/Resources/config/services.yml index a6f0edf..379d4e0 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -6,10 +6,5 @@ services: youshido.graphql.processor: class: %youshido.graphql.processor.class% calls: - - [ setSchema, [@youshido.graphql.schema]] - - [ setContainer, [@service_container]] + - [ setContainer, ['@service_container']] - [ setLogger, [%youshido.graphql.logger%] ] - - - youshido.graphql.schema: - class: %youshido.graphql.project_schema%