Skip to content

Commit

Permalink
updates for the simple installation
Browse files Browse the repository at this point in the history
  • Loading branch information
viniychuk committed May 9, 2016
1 parent 00f4b33 commit f6c5682
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Command/GenerateSchemaCommand.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace AppBundle\Command;
namespace Youshido\GraphQLBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
Expand All @@ -14,7 +14,7 @@ class GenerateSchemaCommand extends ContainerAwareCommand
protected function configure()
{
$this
->setName('graphql:generate-schema')
->setName('graphql:schema:generate')
->setDescription('Generates GraphQL Schema class')
->addArgument('bundle', InputArgument::REQUIRED, 'Bundle to generate class to');
}
Expand Down
5 changes: 3 additions & 2 deletions Controller/GraphQLController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand All @@ -52,4 +53,4 @@ public function defaultAction()
return new JsonResponse($processor->getResponseData(), 200, $this->getParameter('youshido.graphql.response_headers'));
}

}
}
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/GraphQLExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -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' => '*'],
];
}

Expand Down
7 changes: 1 addition & 6 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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%

0 comments on commit f6c5682

Please sign in to comment.