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 dbd274c

Browse filesBrowse files
committed
minor #16211 Adding redirect to current route (ThomasLandauer)
This PR was merged into the 4.4 branch. Discussion ---------- Adding redirect to current route Taken from symfony/symfony#44485 (comment) Plus fixing syntax error I missed in #16206 Commits ------- f4122ee Adding redirect to current route
2 parents 83bdd35 + f4122ee commit dbd274c
Copy full SHA for dbd274c

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+4
-1
lines changed

‎controller.rst

Copy file name to clipboardExpand all lines: controller.rst
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ If you want to redirect the user to another page, use the ``redirectToRoute()``
132132
and ``redirect()`` methods::
133133

134134
use Symfony\Component\HttpFoundation\RedirectResponse;
135-
use Symfony\Component\HttpFoundation\Response
135+
use Symfony\Component\HttpFoundation\Response;
136136

137137
// ...
138138
public function index(): RedirectResponse
@@ -153,6 +153,9 @@ and ``redirect()`` methods::
153153

154154
// redirects to a route and maintains the original query string parameters
155155
return $this->redirectToRoute('blog_show', $request->query->all());
156+
157+
// redirects to the current route (e.g. for Post/Redirect/Get pattern):
158+
return $this->redirectToRoute($request->attributes->get('_route'));
156159

157160
// redirects externally
158161
return $this->redirect('http://symfony.com/doc');

0 commit comments

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