Skip to content

Commit c2ef745

Browse files
committed
[#6219] some tweaks
1 parent 722e7f0 commit c2ef745

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

cookbook/routing/extra_information.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
How to Pass Extra Information from a Route to a Controller
55
==========================================================
66

7-
Parameters inside the ``defaults`` collection don't necessarily have to
8-
match a placeholder in the route ``path``. In fact, you can use the
9-
``defaults`` array to specify extra parameters that will then be accessible as
10-
arguments to your controller, and as attributes of the ``Request`` object:
7+
Parameters inside the ``defaults`` collection don't necessarily have to match
8+
a placeholder in the route ``path``. In fact, you can use the ``defaults``
9+
array to specify extra parameters that will then be accessible as arguments
10+
to your controller, and as attributes of the ``Request`` object:
1111

1212
.. configuration-block::
1313

@@ -52,25 +52,25 @@ arguments to your controller, and as attributes of the ``Request`` object:
5252
5353
return $collection;
5454
55-
Now, you can access this extra parameter in your controller, as an argument to the controller method::
55+
Now, you can access this extra parameter in your controller, as an argument
56+
to the controller method::
5657

57-
use Symfony\Component\HttpFoundation\Request;
58-
5958
public function indexAction($page, $title)
6059
{
6160
// ...
6261
}
6362

64-
Alternately, the title could be accessed through the ``Request`` object::
63+
Alternatively, the title could be accessed through the ``Request`` object::
6564

6665
use Symfony\Component\HttpFoundation\Request;
6766
6867
public function indexAction(Request $request, $page)
6968
{
70-
// ...
7169
$title = $request->attributes->get('title');
70+
7271
// ...
7372
}
7473

75-
As you can see, the ``$title`` variable was never defined inside the route path,
76-
but you can still access its value from inside your controller, through the method's argument, or from the ``Request`` object's ``attributes`` bag.
74+
As you can see, the ``$title`` variable was never defined inside the route
75+
path, but you can still access its value from inside your controller, through
76+
the method's argument, or from the ``Request`` object's ``attributes`` bag.

0 commit comments

Comments
 (0)