Skip to content

Commit 86cfeec

Browse files
mikeSimonsonchr-hertel
authored andcommitted
WIP making the profiler configurable
1 parent e31b9d5 commit 86cfeec

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

DependencyInjection/Configuration.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@
2525
*/
2626
class Configuration implements ConfigurationInterface
2727
{
28+
/** @var bool */
29+
private $debug;
30+
31+
/**
32+
* @param bool $debug Whether to use the debug mode
33+
*/
34+
public function __construct(bool $debug)
35+
{
36+
$this->debug = $debug;
37+
}
38+
2839
/**
2940
* Generates the configuration tree.
3041
*
@@ -147,6 +158,7 @@ public function getConfigTreeBuilder(): TreeBuilder
147158
})
148159
->end()
149160
->end()
161+
->booleanNode('profiler_enabled')->defaultValue($this->debug)->end()
150162
->end();
151163

152164
return $treeBuilder;

DependencyInjection/DoctrineMigrationsExtension.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DoctrineMigrationsExtension extends Extension
4040
*/
4141
public function load(array $configs, ContainerBuilder $container): void
4242
{
43-
$configuration = new Configuration();
43+
$configuration = $this->getConfiguration($configs, $container);
4444

4545
$config = $this->processConfiguration($configuration, $configs);
4646

@@ -169,4 +169,12 @@ public function getNamespace(): string
169169
{
170170
return 'http://symfony.com/schema/dic/doctrine/migrations/3.0';
171171
}
172+
173+
/**
174+
* {@inheritDoc}
175+
*/
176+
public function getConfiguration(array $config, ContainerBuilder $container)
177+
{
178+
return new Configuration($container->getParameter('kernel.debug'));
179+
}
172180
}

0 commit comments

Comments
 (0)