From 77342fa097fcb4324d216c236447624b6d0a9341 Mon Sep 17 00:00:00 2001 From: "M.Wiesner" Date: Sat, 13 Dec 2014 17:27:36 +0100 Subject: [PATCH 1/3] Update the_controller.rst Corrected error in the sample code. --- quick_tour/the_controller.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quick_tour/the_controller.rst b/quick_tour/the_controller.rst index 114b2e587b3..36d38c131f3 100644 --- a/quick_tour/the_controller.rst +++ b/quick_tour/the_controller.rst @@ -205,8 +205,8 @@ different controller using the ``forward()`` method:: public function indexAction() { return $this->forward('AppBundle:Blog:index', array( - 'name' => $name - ); + 'name' => 'Fabien' + )); } } From 17c9257c6f9c97035c9d6c50bc5ee2ca9d5b65d3 Mon Sep 17 00:00:00 2001 From: "M.Wiesner" Date: Sat, 13 Dec 2014 21:09:56 +0100 Subject: [PATCH 2/3] Update the_controller.rst --- quick_tour/the_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick_tour/the_controller.rst b/quick_tour/the_controller.rst index 36d38c131f3..a581ff2b45f 100644 --- a/quick_tour/the_controller.rst +++ b/quick_tour/the_controller.rst @@ -205,7 +205,7 @@ different controller using the ``forward()`` method:: public function indexAction() { return $this->forward('AppBundle:Blog:index', array( - 'name' => 'Fabien' + 'name' => 'Fabien', )); } } From dbc25a6fb5d2c870958b462b7a998512049ba44b Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 21 Feb 2015 10:33:35 +0100 Subject: [PATCH 3/3] Removed forwarding section from the quick tour --- quick_tour/the_controller.rst | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/quick_tour/the_controller.rst b/quick_tour/the_controller.rst index a581ff2b45f..bc90f0af99b 100644 --- a/quick_tour/the_controller.rst +++ b/quick_tour/the_controller.rst @@ -172,8 +172,10 @@ The ``hello`` action will now match URLs like ``/hello/fabien.xml`` or like ``/hello/fabien.js``, because the value of the ``_format`` variable doesn't meet its requirements. -Redirecting and Forwarding --------------------------- +.. _redirecting-and-forwarding: + +Redirecting +----------- If you want to redirect the user to another page, use the ``redirectToRoute()`` method:: @@ -193,23 +195,6 @@ method:: The ``redirectToRoute()`` method takes as arguments the route name and an optional array of parameters and redirects the user to the URL generated with those arguments. -You can also internally forward the action to another action of the same or -different controller using the ``forward()`` method:: - - // src/AppBundle/Controller/DefaultController.php - class DefaultController extends Controller - { - /** - * @Route("/", name="homepage") - */ - public function indexAction() - { - return $this->forward('AppBundle:Blog:index', array( - 'name' => 'Fabien', - )); - } - } - Displaying Error Pages ----------------------