* * 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); } }