private function setupAutowire(array $config, ContainerBuilder $container)
    {
        if (!method_exists($container, 'autowire')) {
            // This container have no support for services auto-wiring
            return;
        }

        if (!$config['autowire']) {
            // Auto-wiring for default client is explicitly disabled
            return;
        }

        if (!array_key_exists('default', $config['clients'])) {
            // No "default" client is available
            return;
        }

        if ($container->hasDefinition(Client::class)) {
            throw new LogicException('Default Elasticsearch client autowiring setup is enabled, ' .
                'but Elastica client service is already defined in container');
        }

        $container->setAlias(Client::class, $this->createClientId('default'));
    }
private function setupAutowire(array $config, ContainerBuilder $container)
    {
        if (!method_exists($container, 'autowire')) {
            // This container have no support for services auto-wiring
            return;
        }

        if (!$config['autowire']) {
            // Auto-wiring for default client is explicitly disabled
            return;
        }

        if (!array_key_exists('default', $config['clients'])) {
            // No "default" client is available
            return;
        }

        if ($container->hasDefinition(Client::class)) {
            throw new LogicException('Default Elasticsearch client autowiring setup is enabled, ' .
                'but Elastica client service is already defined in container');
        }

        $container->setAlias(Client::class, $this->createClientId('default'));
    }
private function setupAutowire ( array $ config , ContainerBuilder $ container ) { if ( ! method_exists ( $ container , 'autowire' ) ) { // This container have no support for services auto-wiring return ; } if ( ! $ config [ 'autowire' ] ) { // Auto-wiring for default client is explicitly disabled return ; } if ( ! array_key_exists ( 'default' , $ config [ 'clients' ] ) ) { // No "default" client is available return ; } if ( $ container -> hasDefinition ( Client :: class ) ) { throw new LogicException ( 'Default Elasticsearch client autowiring setup is enabled, ' . 'but Elastica client service is already defined in container' ) ; } $ container -> setAlias ( Client :: class , $ this -> createClientId ( 'default' ) ) ; }
Configure service auto-wiring for default Elastica client
for Symfony 3.3+

@param array $config
@param ContainerBuilder $container

@throws LogicException
Configure service auto - wiring for default Elastica client for Symfony 3 . 3 +