Skip to content

Commit

Permalink
[Config] Fix kernel.debug injection
Browse files Browse the repository at this point in the history
  • Loading branch information
GeLoLabs committed Feb 21, 2017
1 parent 7802562 commit 0714300
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
19 changes: 16 additions & 3 deletions DependencyInjection/Configuration.php
Expand Up @@ -22,6 +22,19 @@
*/
class Configuration implements ConfigurationInterface
{
/**
* @var bool
*/
private $debug;

/**
* @param bool $debug
*/
public function __construct($debug = false)
{
$this->debug = $debug;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -51,7 +64,7 @@ private function createMappingNode()
->arrayNode('cache')
->addDefaultsIfNotSet()
->children()
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
->booleanNode('debug')->defaultValue($this->debug)->end()
->scalarNode('prefix')->defaultValue('ivory_serializer')->end()
->scalarNode('pool')->defaultValue('cache.system')->end()
->end()
Expand Down Expand Up @@ -107,7 +120,7 @@ private function createTypesNode()
->arrayNode('exception')
->addDefaultsIfNotSet()
->children()
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
->booleanNode('debug')->defaultValue($this->debug)->end()
->end()
->end()
->end();
Expand Down Expand Up @@ -142,7 +155,7 @@ private function createVisitorsNode()
->children()
->scalarNode('version')->defaultValue('1.0')->end()
->scalarNode('encoding')->defaultValue('UTF-8')->end()
->booleanNode('format_output')->defaultValue('%kernel.debug%')->end()
->booleanNode('format_output')->defaultValue($this->debug)->end()
->scalarNode('root')->defaultValue('result')->end()
->scalarNode('entry')->defaultValue('entry')->end()
->scalarNode('entry_attribute')->defaultValue('key')->end()
Expand Down
8 changes: 8 additions & 0 deletions DependencyInjection/IvorySerializerExtension.php
Expand Up @@ -30,6 +30,14 @@
*/
class IvorySerializerExtension extends ConfigurableExtension
{
/**
* {@inheritdoc}
*/
public function getConfiguration(array $config, ContainerBuilder $container)
{
return new Configuration($container->getParameter('kernel.debug'));
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit 0714300

Please sign in to comment.