Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions Command/GraphQLDumpSchemaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,20 @@
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\ContainerInterface;

Copy link
Contributor

@mcg-web mcg-web Nov 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this should be final ? I'm not against final classes just want to understand why.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a must, but I think it's important to do it when we maintain a library, this way we don't promote users to extend certain things we don't want them to. When you leave it open you create some sort of legacy and can make some users suffer to update.
Now if they want to extend it they'll have to create a new command with their behavior, which I think is for their and our advantage!

class GraphQLDumpSchemaCommand extends Command
final class GraphQLDumpSchemaCommand extends Command
{
/** @var ContainerInterface */
private $container;

/** @var string */
private $relayVersion;

/** @var string */
private $baseExportPath;

public function __construct(
ContainerInterface $container,
$relayVersion,
$baseExportPath
) {
parent::__construct();
$this->container = $container;
$this->relayVersion = $relayVersion;
$this->baseExportPath = $baseExportPath;
}

Expand Down Expand Up @@ -126,12 +121,7 @@ private function useModernJsonFormat(InputInterface $input)
throw new \InvalidArgumentException('"modern" and "classic" options should not be used together.');
}

// none chosen so fallback on default behavior
if (!$modern && !$classic) {
return 'modern' === $this->relayVersion;
}

return $modern;
return true === $modern;
}

/**
Expand Down
6 changes: 0 additions & 6 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,6 @@ public function getConfigTreeBuilder()
->booleanNode('handle_cors')->defaultFalse()->end()
->end()
->end()
->arrayNode('versions')
->addDefaultsIfNotSet()
->children()
->enumNode('relay')->values(['modern', 'classic'])->defaultValue('classic')->end()
->end()
->end()
->end();

return $treeBuilder;
Expand Down
8 changes: 0 additions & 8 deletions DependencyInjection/OverblogGraphQLExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function load(array $configs, ContainerBuilder $container)
$this->setErrorHandlerArguments($config, $container);
$this->setSecurity($config, $container);
$this->setConfigBuilders($config, $container);
$this->setVersions($config, $container);
$this->setShowDebug($config, $container);
$this->setDefinitionParameters($config, $container);
$this->setClassLoaderListener($config, $container);
Expand Down Expand Up @@ -123,13 +122,6 @@ private function setShowDebug(array $config, ContainerBuilder $container)
$container->getDefinition($this->getAlias().'.request_executor')->replaceArgument(4, $config['definitions']['show_debug_info']);
}

private function setVersions(array $config, ContainerBuilder $container)
{
foreach ($config['versions'] as $key => $version) {
$container->setParameter(sprintf('%s.versions.%s', $this->getAlias(), $key), $version);
}
}

private function setConfigBuilders(array $config, ContainerBuilder $container)
{
$useObjectToAddResource = method_exists($container, 'addObjectResource');
Expand Down
1 change: 0 additions & 1 deletion Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ services:
# is instanced before ClassLoaderEvent. This issues is fix in Symfony 3.4 introducing lazy commands
# see https://symfony.com/blog/new-in-symfony-3-4-lazy-commands
- '@service_container'
- "%overblog_graphql.versions.relay%"
- "%kernel.root_dir%"
tags:
- { name: console.command }
Expand Down
24 changes: 24 additions & 0 deletions UPGRADE-0.11.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,27 @@ UPGRADE FROM 0.10 to 0.11
- Installing OverblogGraphiQLBundle
- `composer require --dev overblog/graphiql-bundle`
- Follow instructions at https://github.com/overblog/GraphiQLBundle
- In case you have defined the `versions` in your configuration
- Remove it from `overblog_graphql`
```diff
overblog_graphql:
- versions:
- graphiql: "0.11"
- react: "15.6"
- fetch: "2.0"
- relay: "classic"
```
- Add it to `overblog_graphiql`
```diff
overblog_graphiql:
+ javascript_libraries:
+ graphiql: "0.11"
+ react: "15.6"
+ fetch: "2.0"
```
- If you were using the `graphql:dump-schema` and depending on the `relay`
version as in the previous configuration, now you have to explicitly choose
for a format during the command:
```
bin/console graphql:dump-schema --modern
```