Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f6db30e

Browse filesBrowse files
committed
bug symfony#5251 [Cookbook][Controller] replace docs for removed forward() method (xabbuh)
This PR was merged into the 2.3 branch. Discussion ---------- [Cookbook][Controller] replace docs for removed `forward()` method | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | symfony/symfony#8783 The `forward()` method was removed from the `HttpKernel` class in the FrameworkBundle in Symfony 2.3. Instead, the current request needs to be duplicated and handled by the kernel's `handle()` method. Commits ------- bd62078 replace docs for removed `forward()` method
2 parents ce7eb04 + bd62078 commit f6db30e
Copy full SHA for f6db30e

File tree

Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed

‎cookbook/controller/service.rst

Copy file name to clipboardExpand all lines: cookbook/controller/service.rst
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,13 @@ controller:
258258
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::forward` (service: ``http_kernel``)
259259
.. code-block:: php
260260
261-
$httpKernel->forward($controller, $path, $query);
261+
use Symfony\Component\HttpKernel\HttpKernelInterface;
262+
// ...
263+
264+
$request = ...;
265+
$attributes = array_merge($path, array('_controller' => $controller));
266+
$subRequest = $request->duplicate($query, null, $attributes);
267+
$httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
262268
263269
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::generateUrl` (service: ``router``)
264270
.. code-block:: php

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.