Skip to content

[FrameworkBundle] feature: redirect query params too in RedirectController #9314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 26, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion routing/redirect_in_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Redirecting Using a Route

Assume you are migrating your website from WordPress to Symfony, you want to
redirect ``/wp-admin`` to the route ``sonata_admin_dashboard``. You don't know
the path, only the route name. This can be achieved using the
the path, only the route name, if you pass query parameters to this route and active the ``keepQueryParams``, it will be redirected too. This can be achieved using the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually split lines after the first word that crosses the 72nd character. But we can make that tweak while merging. :)

:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::redirectAction`
action:

Expand All @@ -114,6 +114,7 @@ action:
defaults:
route: sonata_admin_dashboard
permanent: true
keepQueryParams: true

.. code-block:: xml

Expand All @@ -130,6 +131,7 @@ action:
<default key="_controller">Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction</default>
<default key="route">sonata_admin_dashboard</default>
<default key="permanent">true</default>
<default key="keepQueryParams">true</default>
</route>
</routes>

Expand All @@ -146,6 +148,7 @@ action:
'_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction',
'route' => 'sonata_admin_dashboard',
'permanent' => true,
'keepQueryParams' => true,
)));

return $collection;
Expand Down