* * 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 IndexPass implements CompilerPassInterface { /** * {@inheritDoc} */ public function process(ContainerBuilder $container) { if (!$container->hasDefinition('fos_elastica.index_manager')) { return; } $indexes = array(); foreach ($container->findTaggedServiceIds('fos_elastica.index') as $id => $tags) { foreach ($tags as $tag) { $indexes[$tag['name']] = new Reference($id); } } $container->getDefinition('fos_elastica.index_manager')->replaceArgument(0, $indexes); } }