src/DependencyInjection/FOSElasticaExtension.php
private function loadIndexTemplates(array $indexTemplates, ContainerBuilder $container)
    {
        $indexableCallbacks = array();
        foreach ($indexTemplates as $name => $indexTemplate) {
            $indexId = sprintf('fos_elastica.index_template.%s', $name);
            $indexTemplateName = isset($indexTemplate['template_name']) ? $indexTemplate['template_name'] : $name;

            $indexDef = new ChildDefinition('fos_elastica.index_template_prototype');
            $indexDef->setFactory([new Reference('fos_elastica.client'), 'getIndexTemplate']);
            $indexDef->replaceArgument(0, $indexTemplateName);
            $indexDef->addTag('fos_elastica.index_template', array(
                'name' => $name,
            ));

            if (isset($indexTemplate['client'])) {
                $client = $this->getClient($indexTemplate['client']);
                $indexDef->setFactory([$client, 'getIndexTemplate']);
            }

            $container->setDefinition($indexId, $indexDef);
            $reference = new Reference($indexId);

            $this->indexTemplateConfigs[$name] = array(
                'elasticsearch_name' => $indexTemplateName,
                'reference' => $reference,
                'name' => $name,
                'settings' => $indexTemplate['settings'],
                'template' => $indexTemplate['template'],
            );

            $this->loadTypes(
                (array) $indexTemplate['types'],
                $container,
                $this->indexTemplateConfigs[$name],
                $indexableCallbacks
            );
        }

        if ($indexableCallbacks) {
            throw new \RuntimeException('`indexable_callback` option is not supported by index templates');
        }
    }
private function loadIndexTemplates(array $indexTemplates, ContainerBuilder $container)
    {
        $indexableCallbacks = array();
        foreach ($indexTemplates as $name => $indexTemplate) {
            $indexId = sprintf('fos_elastica.index_template.%s', $name);
            $indexTemplateName = isset($indexTemplate['template_name']) ? $indexTemplate['template_name'] : $name;

            $indexDef = new ChildDefinition('fos_elastica.index_template_prototype');
            $indexDef->setFactory([new Reference('fos_elastica.client'), 'getIndexTemplate']);
            $indexDef->replaceArgument(0, $indexTemplateName);
            $indexDef->addTag('fos_elastica.index_template', array(
                'name' => $name,
            ));

            if (isset($indexTemplate['client'])) {
                $client = $this->getClient($indexTemplate['client']);
                $indexDef->setFactory([$client, 'getIndexTemplate']);
            }

            $container->setDefinition($indexId, $indexDef);
            $reference = new Reference($indexId);

            $this->indexTemplateConfigs[$name] = array(
                'elasticsearch_name' => $indexTemplateName,
                'reference' => $reference,
                'name' => $name,
                'settings' => $indexTemplate['settings'],
                'template' => $indexTemplate['template'],
            );

            $this->loadTypes(
                (array) $indexTemplate['types'],
                $container,
                $this->indexTemplateConfigs[$name],
                $indexableCallbacks
            );
        }

        if ($indexableCallbacks) {
            throw new \RuntimeException('`indexable_callback` option is not supported by index templates');
        }
    }
Loads the configured indexes.

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

@throws \InvalidArgumentException

@return void