Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #89 from ajgarlag/bugfix/chain-activator
Browse files Browse the repository at this point in the history
Use TraceableChainDecorator in debug mode only
  • Loading branch information
mKnoop authored Apr 22, 2022
2 parents 16b1061 + bb28aac commit c16e7b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/DependencyInjection/FlagceptionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Exception;
use Flagception\Activator\FeatureActivatorInterface;
use Flagception\Bundle\FlagceptionBundle\Activator\TraceableChainActivator;
use Flagception\Bundle\FlagceptionBundle\DependencyInjection\Configurator\ActivatorConfiguratorInterface;
use Flagception\Decorator\ContextDecoratorInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -51,6 +52,11 @@ public function load(array $configs, ContainerBuilder $container)
$configurator->addActivator($container, $config['activators'][$name], $config['features']);
}

if ($container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) {
$chainDefinition = $container->getDefinition('flagception.activator.chain_activator');
$chainDefinition->setClass(TraceableChainActivator::class);
}

if (method_exists($container, 'registerForAutoconfiguration') === true) {
$container
->registerForAutoconfiguration(FeatureActivatorInterface::class)
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ services:
public: false

flagception.activator.chain_activator:
class: Flagception\Bundle\FlagceptionBundle\Activator\TraceableChainActivator
class: Flagception\Activator\ChainActivator
public: false

flagception.decorator.chain_decorator:
Expand Down

0 comments on commit c16e7b9

Please sign in to comment.