37 lines
1 KiB
PHP
37 lines
1 KiB
PHP
|
<?php
|
||
|
|
||
|
/**
|
||
|
* This file is part of the FOSElasticaBundle project.
|
||
|
*
|
||
|
* (c) Tim Nagel <tim@nagel.com.au>
|
||
|
*
|
||
|
* For the full copyright and license information, please view the LICENSE
|
||
|
* file that was distributed with this source code.
|
||
|
*/
|
||
|
|
||
|
namespace FOS\ElasticaBundle\DependencyInjection\Compiler;
|
||
|
|
||
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||
|
use Symfony\Component\DependencyInjection\Reference;
|
||
|
|
||
|
class ConfigSourcePass implements CompilerPassInterface
|
||
|
{
|
||
|
/**
|
||
|
* {@inheritDoc}
|
||
|
*/
|
||
|
public function process(ContainerBuilder $container)
|
||
|
{
|
||
|
if (!$container->hasDefinition('fos_elastica.config_manager')) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
$sources = array();
|
||
|
foreach (array_keys($container->findTaggedServiceIds('fos_elastica.config_source')) as $id) {
|
||
|
$sources[] = new Reference($id);
|
||
|
}
|
||
|
|
||
|
$container->getDefinition('fos_elastica.config_manager')->replaceArgument(0, $sources);
|
||
|
}
|
||
|
}
|