Skip to content

Finish 4644: Update the_controller.rst #5037

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
Mar 14, 2015
Merged
Changes from all commits
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
23 changes: 4 additions & 19 deletions quick_tour/the_controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

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

We should add a label for the old headline.

Copy link
Member Author

Choose a reason for hiding this comment

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

added

-----------

If you want to redirect the user to another page, use the ``redirectToRoute()``
method::
Expand All @@ -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' => $name
);
}
}

Displaying Error Pages
----------------------

Expand Down