Skip to content

Commit

Permalink
fixed request scope issues (refs #7457)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed May 9, 2013
1 parent e9bd48e commit 853f681
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php
Expand Up @@ -28,6 +28,7 @@
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\Scope;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass;
Expand All @@ -54,6 +55,10 @@ public function build(ContainerBuilder $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 ProfilerPass());
$container->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_AFTER_REMOVING);
Expand Down
Expand Up @@ -42,7 +42,11 @@ public function __construct(EventDispatcherInterface $dispatcher, ContainerInter
parent::__construct($dispatcher, $controllerResolver);

$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'));
}
}

/**
Expand Down

0 comments on commit 853f681

Please sign in to comment.