@@ -1201,7 +1201,7 @@ By default, the router will generate relative URLs (e.g. ``/blog``). To generate
1201
1201
an absolute URL, simply pass ``true `` to the third argument of the ``generate() ``
1202
1202
method::
1203
1203
1204
- $router->generate('blog_show', array('slug' => 'my-blog-post'), true);
1204
+ $this-get(' router') ->generate('blog_show', array('slug' => 'my-blog-post'), true);
1205
1205
// http://www.example.com/blog/my-blog-post
1206
1206
1207
1207
.. note ::
@@ -1212,7 +1212,7 @@ method::
1212
1212
scripts run from the command line, you'll need to manually set the desired
1213
1213
host on the ``RequestContext `` object::
1214
1214
1215
- $router->getContext()->setHost('www.example.com');
1215
+ $this-get(' router') ->getContext()->setHost('www.example.com');
1216
1216
1217
1217
.. index ::
1218
1218
single: Routing; Generating URLs in a template
@@ -1223,7 +1223,7 @@ Generating URLs with Query Strings
1223
1223
The ``generate `` method takes an array of wildcard values to generate the URI.
1224
1224
But if you pass extra ones, they will be added to the URI as a query string::
1225
1225
1226
- $router->generate('blog', array('page' => 2, 'category' => 'Symfony'));
1226
+ $this-get(' router') ->generate('blog', array('page' => 2, 'category' => 'Symfony'));
1227
1227
// /blog/2?category=Symfony
1228
1228
1229
1229
Generating URLs from a template
0 commit comments