private function loadIndexes(array $indexes, ContainerBuilder $container)
    {
        foreach ($indexes as $name => $index) {
            $indexId = sprintf('phlexible_elastica.index.%s', $name);
            $indexName = isset($index['index_name']) ? $index['index_name'] : $name;
            $indexDef = new DefinitionDecorator('phlexible_elastica.index_prototype');
            $indexDef->replaceArgument(0, $indexName);
            $indexDef->addTag('phlexible_elastica.index', array(
                'name' => $name,
            ));
            if (method_exists($indexDef, 'setFactory')) {
                $indexDef->setFactory(array(new Reference('phlexible_elastica.client'), 'getIndex'));
            } else {
                // To be removed when dependency on Symfony DependencyInjection is bumped to 2.6
                $indexDef->setFactoryService('phlexible_elastica.client');
                $indexDef->setFactoryMethod('getIndex');
            }
            if (isset($index['client'])) {
                $client = $this->getClient($index['client']);
                if (method_exists($indexDef, 'setFactory')) {
                    $indexDef->setFactory(array($client, 'getIndex'));
                } else {
                    // To be removed when dependency on Symfony DependencyInjection is bumped to 2.6
                    $indexDef->setFactoryService('phlexible_elastica.client');
                    $indexDef->setFactoryMethod('getIndex');
                }
            }
            $container->setDefinition($indexId, $indexDef);
            $reference = new Reference($indexId);
            $this->indexConfigs[$name] = array(
                'elasticsearch_name' => $indexName,
                'reference' => $reference,
                'name' => $name,
                'settings' => $index['settings'],
                'type_prototype' => isset($index['type_prototype']) ? $index['type_prototype'] : array(),
                'use_alias' => $index['use_alias'],
            );
        }
    }
private function loadIndexes(array $indexes, ContainerBuilder $container)
    {
        foreach ($indexes as $name => $index) {
            $indexId = sprintf('phlexible_elastica.index.%s', $name);
            $indexName = isset($index['index_name']) ? $index['index_name'] : $name;
            $indexDef = new DefinitionDecorator('phlexible_elastica.index_prototype');
            $indexDef->replaceArgument(0, $indexName);
            $indexDef->addTag('phlexible_elastica.index', array(
                'name' => $name,
            ));
            if (method_exists($indexDef, 'setFactory')) {
                $indexDef->setFactory(array(new Reference('phlexible_elastica.client'), 'getIndex'));
            } else {
                // To be removed when dependency on Symfony DependencyInjection is bumped to 2.6
                $indexDef->setFactoryService('phlexible_elastica.client');
                $indexDef->setFactoryMethod('getIndex');
            }
            if (isset($index['client'])) {
                $client = $this->getClient($index['client']);
                if (method_exists($indexDef, 'setFactory')) {
                    $indexDef->setFactory(array($client, 'getIndex'));
                } else {
                    // To be removed when dependency on Symfony DependencyInjection is bumped to 2.6
                    $indexDef->setFactoryService('phlexible_elastica.client');
                    $indexDef->setFactoryMethod('getIndex');
                }
            }
            $container->setDefinition($indexId, $indexDef);
            $reference = new Reference($indexId);
            $this->indexConfigs[$name] = array(
                'elasticsearch_name' => $indexName,
                'reference' => $reference,
                'name' => $name,
                'settings' => $index['settings'],
                'type_prototype' => isset($index['type_prototype']) ? $index['type_prototype'] : array(),
                'use_alias' => $index['use_alias'],
            );
        }
    }
private function loadIndexes ( array $ indexes , ContainerBuilder $ container ) { foreach ( $ indexes as $ name => $ index ) { $ indexId = sprintf ( 'phlexible_elastica.index.%s' , $ name ) ; $ indexName = isset ( $ index [ 'index_name' ] ) ? $ index [ 'index_name' ] : $ name ; $ indexDef = new DefinitionDecorator ( 'phlexible_elastica.index_prototype' ) ; $ indexDef -> replaceArgument ( 0 , $ indexName ) ; $ indexDef -> addTag ( 'phlexible_elastica.index' , array ( 'name' => $ name , ) ) ; if ( method_exists ( $ indexDef , 'setFactory' ) ) { $ indexDef -> setFactory ( array ( new Reference ( 'phlexible_elastica.client' ) , 'getIndex' ) ) ; } else { // To be removed when dependency on Symfony DependencyInjection is bumped to 2.6 $ indexDef -> setFactoryService ( 'phlexible_elastica.client' ) ; $ indexDef -> setFactoryMethod ( 'getIndex' ) ; } if ( isset ( $ index [ 'client' ] ) ) { $ client = $ this -> getClient ( $ index [ 'client' ] ) ; if ( method_exists ( $ indexDef , 'setFactory' ) ) { $ indexDef -> setFactory ( array ( $ client , 'getIndex' ) ) ; } else { // To be removed when dependency on Symfony DependencyInjection is bumped to 2.6 $ indexDef -> setFactoryService ( 'phlexible_elastica.client' ) ; $ indexDef -> setFactoryMethod ( 'getIndex' ) ; } } $ container -> setDefinition ( $ indexId , $ indexDef ) ; $ reference = new Reference ( $ indexId ) ; $ this -> indexConfigs [ $ name ] = array ( 'elasticsearch_name' => $ indexName , 'reference' => $ reference , 'name' => $ name , 'settings' => $ index [ 'settings' ] , 'type_prototype' => isset ( $ index [ 'type_prototype' ] ) ? $ index [ 'type_prototype' ] : array ( ) , 'use_alias' => $ index [ 'use_alias' ] , ) ; } }
Loads the configured indexes.

@param array            $indexes   An array of indexes configurations
@param ContainerBuilder $container A ContainerBuilder instance

@throws InvalidArgumentException

@return array
Loads the configured indexes .