-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathEventDeferringCompilerPass.php
More file actions
33 lines (28 loc) · 1.03 KB
/
EventDeferringCompilerPass.php
File metadata and controls
33 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
namespace Smartbox\Integration\FrameworkBundle\DependencyInjection\CompilerPasses;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Class EventDeferringCompilerPass.
*/
class EventDeferringCompilerPass implements CompilerPassInterface
{
const TAG_EVENTS_FILTER = 'smartesb.events.deferring_filter';
/**
* You can modify the container here before it is dumped to PHP code.
*
* @param ContainerBuilder $container
*
* @api
*/
public function process(ContainerBuilder $container)
{
$filters = $container->findTaggedServiceIds(self::TAG_EVENTS_FILTER);
$filtersRepoDef = $container->getDefinition('smartesb.registry.event_filters');
foreach ($filters as $serviceName => $tags) {
$filtersRepoDef->addMethodCall('addDeferringFilter', [new Reference($serviceName)]);
$tags->setPublic(true);
}
}
}