class ContainerAwareHttpKernel in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/DependencyInjection/ContainerAwareHttpKernel.php \Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel
Adds a managed request scope.
@author Fabien Potencier <fabien@symfony.com> @author Johannes M. Schmitt <schmittjoh@gmail.com>
Hierarchy
- class \Symfony\Component\HttpKernel\HttpKernel implements HttpKernelInterface, TerminableInterface
- class \Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel
Expanded class hierarchy of ContainerAwareHttpKernel
Deprecated
since version 2.7, to be removed in 3.0.
1 file declares its use of ContainerAwareHttpKernel
- ContainerAwareHttpKernelTest.php in vendor/
symfony/ http-kernel/ Tests/ DependencyInjection/ ContainerAwareHttpKernelTest.php
File
- vendor/
symfony/ http-kernel/ DependencyInjection/ ContainerAwareHttpKernel.php, line 31
Namespace
Symfony\Component\HttpKernel\DependencyInjectionView source
class ContainerAwareHttpKernel extends HttpKernel {
protected $container;
/**
* Constructor.
*
* @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance
* @param ContainerInterface $container A ContainerInterface instance
* @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance
* @param RequestStack $requestStack A stack for master/sub requests
* @param bool $triggerDeprecation Whether or not to trigger the deprecation warning for the ContainerAwareHttpKernel
*/
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null, $triggerDeprecation = true) {
parent::__construct($dispatcher, $controllerResolver, $requestStack);
if ($triggerDeprecation) {
@trigger_error('The ' . __CLASS__ . ' class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\\Component\\HttpKernel\\HttpKernel class instead.', E_USER_DEPRECATED);
}
$this->container = $container;
// the request scope might have been created before (see FrameworkBundle)
if (!$container
->hasScope('request')) {
$container
->addScope(new Scope('request'));
}
}
/**
* {@inheritdoc}
*/
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) {
$this->container
->enterScope('request');
$this->container
->set('request', $request, 'request');
try {
$response = parent::handle($request, $type, $catch);
} catch (\Exception $e) {
$this->container
->set('request', null, 'request');
$this->container
->leaveScope('request');
throw $e;
}
$this->container
->set('request', null, 'request');
$this->container
->leaveScope('request');
return $response;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContainerAwareHttpKernel:: |
protected | property | ||
ContainerAwareHttpKernel:: |
public | function |
Handles a Request to convert it to a Response. Overrides HttpKernel:: |
|
ContainerAwareHttpKernel:: |
public | function |
Constructor. Overrides HttpKernel:: |
|
HttpKernel:: |
protected | property | ||
HttpKernel:: |
protected | property | ||
HttpKernel:: |
protected | property | ||
HttpKernel:: |
private | function | Filters a response object. | |
HttpKernel:: |
private | function | Publishes the finish request event, then pop the request from the stack. | |
HttpKernel:: |
private | function | Handles an exception by trying to convert it to a Response. | |
HttpKernel:: |
private | function | Handles a request to convert it to a response. | |
HttpKernel:: |
public | function |
Terminates a request/response cycle. Overrides TerminableInterface:: |
|
HttpKernel:: |
public | function | @internal | |
HttpKernel:: |
private | function | ||
HttpKernelInterface:: |
constant | |||
HttpKernelInterface:: |
constant |