diff --git a/DependencyInjection/Compiler/ModifierClassPass.php b/DependencyInjection/Compiler/ModifierClassPass.php new file mode 100644 index 0000000..a599048 --- /dev/null +++ b/DependencyInjection/Compiler/ModifierClassPass.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ConnectionsBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Sets modifier class to abstract service. + */ +class ModifierClassPass implements CompilerPassInterface +{ + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if ($container->hasParameter('ongr_connections.import.modifier.class')) { + $container + ->getDefinition('ongr_connections.import.modifier') + ->setClass($container->getParameter('ongr_connections.import.modifier.class')); + } + } +} diff --git a/ONGRConnectionsBundle.php b/ONGRConnectionsBundle.php index dcfa036..b2e0227 100644 --- a/ONGRConnectionsBundle.php +++ b/ONGRConnectionsBundle.php @@ -12,6 +12,7 @@ namespace ONGR\ConnectionsBundle; use ONGR\ConnectionsBundle\DependencyInjection\Compiler\ExtractionDescriptorPass; +use ONGR\ConnectionsBundle\DependencyInjection\Compiler\ModifierClassPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; @@ -28,5 +29,6 @@ public function build(ContainerBuilder $container) parent::build($container); $container->addCompilerPass(new ExtractionDescriptorPass()); + $container->addCompilerPass(new ModifierClassPass()); } } diff --git a/Tests/app/config/services.yml b/Tests/app/config/services.yml index 3cccd79..3029cd5 100644 --- a/Tests/app/config/services.yml +++ b/Tests/app/config/services.yml @@ -65,7 +65,7 @@ services: - { name: kernel.event_listener, event: ongr.pipeline.import.default.source, method: onSource } test.import.modifier: - class: %ongr_connections.import.modifier.class% + parent: ongr_connections.import.modifier tags: - { name: kernel.event_listener, event: ongr.pipeline.import.default.modify, method: onModify }