function InlineFragmentRenderer::createSubRequest
1 call to InlineFragmentRenderer::createSubRequest()
- InlineFragmentRenderer::render in vendor/
symfony/ http-kernel/ Fragment/ InlineFragmentRenderer.php - Additional available options:
File
-
vendor/
symfony/ http-kernel/ Fragment/ InlineFragmentRenderer.php, line 103
Class
- InlineFragmentRenderer
- Implements the inline rendering strategy where the Request is rendered by the current HTTP kernel.
Namespace
Symfony\Component\HttpKernel\FragmentCode
protected function createSubRequest(string $uri, Request $request) : Request {
$cookies = $request->cookies
->all();
$server = $request->server
->all();
unset($server['HTTP_IF_MODIFIED_SINCE']);
unset($server['HTTP_IF_NONE_MATCH']);
$subRequest = Request::create($uri, 'get', [], $cookies, [], $server);
if ($request->headers
->has('Surrogate-Capability')) {
$subRequest->headers
->set('Surrogate-Capability', $request->headers
->get('Surrogate-Capability'));
}
static $setSession;
$setSession ??= \Closure::bind(static function ($subRequest, $request) {
$subRequest->session = $request->session;
}, null, Request::class);
$setSession($subRequest, $request);
if ($request->get('_format')) {
$subRequest->attributes
->set('_format', $request->get('_format'));
}
if ($request->getDefaultLocale() !== $request->getLocale()) {
$subRequest->setLocale($request->getLocale());
}
if ($request->attributes
->has('_stateless')) {
$subRequest->attributes
->set('_stateless', $request->attributes
->get('_stateless'));
}
if ($request->attributes
->has('_check_controller_is_allowed')) {
$subRequest->attributes
->set('_check_controller_is_allowed', $request->attributes
->get('_check_controller_is_allowed'));
}
return $subRequest;
}