/
LoadersCompilerPass.php
35 lines (29 loc) · 1.09 KB
/
LoadersCompilerPass.php
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
34
35
<?php
/*
* This file is part of the `liip/LiipImagineBundle` project.
*
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace Liip\ImagineBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
class LoadersCompilerPass extends AbstractCompilerPass
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
$tags = $container->findTaggedServiceIds('liip_imagine.binary.loader');
if (count($tags) > 0 && $container->hasDefinition('liip_imagine.data.manager')) {
$manager = $container->getDefinition('liip_imagine.data.manager');
foreach ($tags as $id => $tag) {
$manager->addMethodCall('addLoader', [$tag[0]['loader'], new Reference($id)]);
$this->log($container, 'Registered binary loader: %s', $id);
}
}
}
}