src/DependencyInjection/FOSElasticaExtension.php
private function createDefaultManagerAlias($defaultManager, ContainerBuilder $container)
    {
        if (0 == count($this->loadedDrivers)) {
            return;
        }

        if (count($this->loadedDrivers) > 1
            && in_array($defaultManager, $this->loadedDrivers)
        ) {
            $defaultManagerService = $defaultManager;
        } else {
            $defaultManagerService = $this->loadedDrivers[0];
        }

        $container->setAlias('fos_elastica.manager', sprintf('fos_elastica.manager.%s', $defaultManagerService));
        $container->getAlias('fos_elastica.manager')->setPublic(true);
        $container->setAlias(RepositoryManagerInterface::class, 'fos_elastica.manager');
        $container->getAlias(RepositoryManagerInterface::class)->setPublic(false);
    }
private function createDefaultManagerAlias($defaultManager, ContainerBuilder $container)
    {
        if (0 == count($this->loadedDrivers)) {
            return;
        }

        if (count($this->loadedDrivers) > 1
            && in_array($defaultManager, $this->loadedDrivers)
        ) {
            $defaultManagerService = $defaultManager;
        } else {
            $defaultManagerService = $this->loadedDrivers[0];
        }

        $container->setAlias('fos_elastica.manager', sprintf('fos_elastica.manager.%s', $defaultManagerService));
        $container->getAlias('fos_elastica.manager')->setPublic(true);
        $container->setAlias(RepositoryManagerInterface::class, 'fos_elastica.manager');
        $container->getAlias(RepositoryManagerInterface::class)->setPublic(false);
    }
Creates a default manager alias for defined default manager or the first loaded driver.

@param string           $defaultManager
@param ContainerBuilder $container