DependencyInjection/M6WebApiExceptionExtension.php
protected function loadExceptionListener(ContainerBuilder $container, array $config)
    {
        $definition = new Definition(
            'M6Web\Bundle\ApiExceptionBundle\EventListener\ExceptionListener',
            [
                new Reference('kernel'),
                new Reference($this->getAlias().'.manager.exception'),
                $config['match_all'],
                $config['default'],
                $config['stack_trace'],
            ]
        );

        $definition->setPublic(true);

        $definition->addTag(
            'kernel.event_listener',
            [
                'event' => 'kernel.exception',
                'method' => 'onKernelException',
                'priority' => '-100' // as the setResponse stop the exception propagation, this listener has to pass in last position
            ]
        );

        $container->setDefinition($this->getAlias().'.listener.exception', $definition);
    }
protected function loadExceptionListener(ContainerBuilder $container, array $config)
    {
        $definition = new Definition(
            'M6Web\Bundle\ApiExceptionBundle\EventListener\ExceptionListener',
            [
                new Reference('kernel'),
                new Reference($this->getAlias().'.manager.exception'),
                $config['match_all'],
                $config['default'],
                $config['stack_trace'],
            ]
        );

        $definition->setPublic(true);

        $definition->addTag(
            'kernel.event_listener',
            [
                'event' => 'kernel.exception',
                'method' => 'onKernelException',
                'priority' => '-100' // as the setResponse stop the exception propagation, this listener has to pass in last position
            ]
        );

        $container->setDefinition($this->getAlias().'.listener.exception', $definition);
    }
protected function loadExceptionListener ( ContainerBuilder $ container , array $ config ) { $ definition = new Definition ( 'M6Web\Bundle\ApiExceptionBundle\EventListener\ExceptionListener' , [ new Reference ( 'kernel' ) , new Reference ( $ this -> getAlias ( ) . '.manager.exception' ) , $ config [ 'match_all' ] , $ config [ 'default' ] , $ config [ 'stack_trace' ] , ] ) ; $ definition -> setPublic ( true ) ; $ definition -> addTag ( 'kernel.event_listener' , [ 'event' => 'kernel.exception' , 'method' => 'onKernelException' , 'priority' => '-100' // as the setResponse stop the exception propagation, this listener has to pass in last position ] ) ; $ container -> setDefinition ( $ this -> getAlias ( ) . '.listener.exception' , $ definition ) ; }
load service exception listener

@param ContainerBuilder $container
@param array            $config
load service exception listener