-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathBlockProviderCompilerPass.php
More file actions
32 lines (26 loc) · 938 Bytes
/
BlockProviderCompilerPass.php
File metadata and controls
32 lines (26 loc) · 938 Bytes
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
<?php
namespace Ibrows\Bundle\NewsletterBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Reference;
class BlockProviderCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if(!$container->hasDefinition('ibrows_newsletter.block_provider_manager')) {
return;
}
$definition = $container->getDefinition(
'ibrows_newsletter.block_provider_manager'
);
$taggedServices = $container->findTaggedServiceIds(
'ibrows_newsletter.block.provider'
);
foreach($taggedServices as $id => $attributes){
$definition->addMethodCall(
'addBlockProvider',
array($id, new Reference($id))
);
}
}
}