public function process(ContainerBuilder $container)
    {
        if (!$container->has($this->callableServiceId)) {
            return;
        }

        if (!$container->has($this->serviceLocatorId)) {
            return;
        }

        $callableDefinition = $container->findDefinition($this->callableServiceId);
        $serviceLocatorDefinition = $container->findDefinition($this->serviceLocatorId);

        $handlers = array();
        $services = array();

        $this->collectServiceIds(
            $container,
            $this->tag,
            $this->keyAttribute,
            function ($key, $serviceId, array $tagAttributes) use (&$handlers, &$services) {
                if (isset($tagAttributes['method'])) {
                    // Symfony 3.3 supports services by classname. This interferes with `is_callable`
                    // in `ServiceLocatorAwareCallableResolver`
                    $callable = [
                        'serviceId' => $serviceId,
                        'method'    => $tagAttributes['method'],
                    ];
                } else {
                    $callable = $serviceId;
                }

                $handlers[ltrim($key, '\\')][] = $callable;
                $services[$serviceId] = new Reference($serviceId);
            }
        );

        $callableDefinition->replaceArgument(0, $handlers);
        $serviceLocatorDefinition->replaceArgument(0, $services);
    }
public function process(ContainerBuilder $container)
    {
        if (!$container->has($this->callableServiceId)) {
            return;
        }

        if (!$container->has($this->serviceLocatorId)) {
            return;
        }

        $callableDefinition = $container->findDefinition($this->callableServiceId);
        $serviceLocatorDefinition = $container->findDefinition($this->serviceLocatorId);

        $handlers = array();
        $services = array();

        $this->collectServiceIds(
            $container,
            $this->tag,
            $this->keyAttribute,
            function ($key, $serviceId, array $tagAttributes) use (&$handlers, &$services) {
                if (isset($tagAttributes['method'])) {
                    // Symfony 3.3 supports services by classname. This interferes with `is_callable`
                    // in `ServiceLocatorAwareCallableResolver`
                    $callable = [
                        'serviceId' => $serviceId,
                        'method'    => $tagAttributes['method'],
                    ];
                } else {
                    $callable = $serviceId;
                }

                $handlers[ltrim($key, '\\')][] = $callable;
                $services[$serviceId] = new Reference($serviceId);
            }
        );

        $callableDefinition->replaceArgument(0, $handlers);
        $serviceLocatorDefinition->replaceArgument(0, $services);
    }
public function process ( ContainerBuilder $ container ) { if ( ! $ container -> has ( $ this -> callableServiceId ) ) { return ; } if ( ! $ container -> has ( $ this -> serviceLocatorId ) ) { return ; } $ callableDefinition = $ container -> findDefinition ( $ this -> callableServiceId ) ; $ serviceLocatorDefinition = $ container -> findDefinition ( $ this -> serviceLocatorId ) ; $ handlers = array ( ) ; $ services = array ( ) ; $ this -> collectServiceIds ( $ container , $ this -> tag , $ this -> keyAttribute , function ( $ key , $ serviceId , array $ tagAttributes ) use ( & $ handlers , & $ services ) { if ( isset ( $ tagAttributes [ 'method' ] ) ) { // Symfony 3.3 supports services by classname. This interferes with `is_callable` // in `ServiceLocatorAwareCallableResolver` $ callable = [ 'serviceId' => $ serviceId , 'method' => $ tagAttributes [ 'method' ] , ] ; } else { $ callable = $ serviceId ; } $ handlers [ ltrim ( $ key , '\\' ) ] [ ] = $ callable ; $ services [ $ serviceId ] = new Reference ( $ serviceId ) ; } ) ; $ callableDefinition -> replaceArgument ( 0 , $ handlers ) ; $ serviceLocatorDefinition -> replaceArgument ( 0 , $ services ) ; }
Search for message subscriber services and provide them as a constructor argument to the message subscriber
collection service.

@param ContainerBuilder $container
Search for message subscriber services and provide them as a constructor argument to the message subscriber collection service .