fixed request scope issues (refs #7457)
This commit is contained in:
parent
e9bd48e9b2
commit
853f681957
@ -28,6 +28,7 @@ use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FragmentRenderer
|
|||||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass;
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
||||||
|
use Symfony\Component\DependencyInjection\Scope;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass;
|
use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass;
|
||||||
@ -54,6 +55,10 @@ class FrameworkBundle extends Bundle
|
|||||||
{
|
{
|
||||||
parent::build($container);
|
parent::build($container);
|
||||||
|
|
||||||
|
// we need to add the request scope as early as possible so that
|
||||||
|
// the compilation can find scope widening issues
|
||||||
|
$container->addScope(new Scope('request'));
|
||||||
|
|
||||||
$container->addCompilerPass(new RoutingResolverPass());
|
$container->addCompilerPass(new RoutingResolverPass());
|
||||||
$container->addCompilerPass(new ProfilerPass());
|
$container->addCompilerPass(new ProfilerPass());
|
||||||
$container->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_AFTER_REMOVING);
|
$container->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_AFTER_REMOVING);
|
||||||
|
@ -42,7 +42,11 @@ class ContainerAwareHttpKernel extends HttpKernel
|
|||||||
parent::__construct($dispatcher, $controllerResolver);
|
parent::__construct($dispatcher, $controllerResolver);
|
||||||
|
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
$container->addScope(new Scope('request'));
|
|
||||||
|
// the request scope might have been created before (see FrameworkBundle)
|
||||||
|
if (!$container->hasScope('request')) {
|
||||||
|
$container->addScope(new Scope('request'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user