Skip to content
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

Fixed a minor indentation issue #6528

Merged
merged 1 commit into from
May 3, 2016
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
50 changes: 25 additions & 25 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -321,42 +321,42 @@ Keep the following guidelines in mind while you develop.

#. **The order of the controller arguments does not matter**

Symfony matches the parameter **names** from the route to the variable
**names** of the controller. The arguments of the controller could be
totally reordered and still work perfectly::
Symfony matches the parameter **names** from the route to the variable
**names** of the controller. The arguments of the controller could be
totally reordered and still work perfectly::

public function indexAction($lastName, $firstName)
{
// ...
}
public function indexAction($lastName, $firstName)
{
// ...
}

#. **Each required controller argument must match up with a routing parameter**

The following would throw a ``RuntimeException`` because there is no
``foo`` parameter defined in the route::
The following would throw a ``RuntimeException`` because there is no
``foo`` parameter defined in the route::

public function indexAction($firstName, $lastName, $foo)
{
// ...
}
public function indexAction($firstName, $lastName, $foo)
{
// ...
}

Making the argument optional, however, is perfectly ok. The following
example would not throw an exception::
Making the argument optional, however, is perfectly ok. The following
example would not throw an exception::

public function indexAction($firstName, $lastName, $foo = 'bar')
{
// ...
}
public function indexAction($firstName, $lastName, $foo = 'bar')
{
// ...
}

#. **Not all routing parameters need to be arguments on your controller**

If, for example, the ``lastName`` weren't important for your controller,
you could omit it entirely::
If, for example, the ``lastName`` weren't important for your controller,
you could omit it entirely::

public function indexAction($firstName)
{
// ...
}
public function indexAction($firstName)
{
// ...
}

.. tip::

Expand Down