From 72105860ad65cf2cc83b9633a07e7a6f6c4248e8 Mon Sep 17 00:00:00 2001 From: Hamza Amrouche Date: Fri, 23 Feb 2018 10:40:21 +0100 Subject: [PATCH 1/3] feature: redirect query params too in RedirectController Adding documentation for the redirectAction improvement --- routing/redirect_in_config.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/routing/redirect_in_config.rst b/routing/redirect_in_config.rst index 89864c4c06c..1430ae6b87a 100644 --- a/routing/redirect_in_config.rst +++ b/routing/redirect_in_config.rst @@ -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 :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::redirectAction` action: @@ -114,6 +114,7 @@ action: defaults: route: sonata_admin_dashboard permanent: true + keepQueryParams: true .. code-block:: xml @@ -130,6 +131,7 @@ action: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction sonata_admin_dashboard true + true @@ -146,6 +148,7 @@ action: '_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction', 'route' => 'sonata_admin_dashboard', 'permanent' => true, + 'keepQueryParams' => true, ))); return $collection; From 6c92c05e2bd57b5e66f8b4f494ee723be8a47ca3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 25 Apr 2018 15:32:43 +0200 Subject: [PATCH 2/3] Reworded the new option explanation --- routing/redirect_in_config.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/routing/redirect_in_config.rst b/routing/redirect_in_config.rst index 1430ae6b87a..31bb53d82ed 100644 --- a/routing/redirect_in_config.rst +++ b/routing/redirect_in_config.rst @@ -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, if you pass query parameters to this route and active the ``keepQueryParams``, it will be redirected too. This can be achieved using the +the path, only the route name This can be achieved using the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::redirectAction` action: @@ -113,7 +113,9 @@ action: controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction defaults: route: sonata_admin_dashboard + # make a permanent redirection... permanent: true + # ...and keep the original query string parameters keepQueryParams: true .. code-block:: xml @@ -130,7 +132,9 @@ action: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction sonata_admin_dashboard + true + true @@ -147,7 +151,9 @@ action: $collection->add('admin', new Route('/wp-admin', array( '_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction', 'route' => 'sonata_admin_dashboard', + // make a permanent redirection... 'permanent' => true, + // ...and keep the original query string parameters 'keepQueryParams' => true, ))); From ba5c3432057b47e299c215fbe6b295ccd135e600 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 25 Apr 2018 15:33:12 +0200 Subject: [PATCH 3/3] Restored a removed character --- routing/redirect_in_config.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routing/redirect_in_config.rst b/routing/redirect_in_config.rst index 31bb53d82ed..a578acceb28 100644 --- a/routing/redirect_in_config.rst +++ b/routing/redirect_in_config.rst @@ -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. This can be achieved using the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::redirectAction` action: