Skip to content

Commit

Permalink
[book] [routing] fixed a note that wasn't properly updated
Browse files Browse the repository at this point in the history
Previously, the code used the generate() method of the service and
the note explained the generateUrl() method of the base controller.
Then, the example was updated to use the generateUrl(), but the
note kept explaining the generateUrl(). This change is just about
explaining in the note the alterantive generate() method of the service.
  • Loading branch information
javiereguiluz committed Mar 29, 2014
1 parent 355cd5b commit 26f9e3b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions book/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1168,12 +1168,15 @@ route. With this information, any URL can easily be generated::

.. note::

In controllers that extend Symfony's base
In controllers that don't extend Symfony's base
:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller`,
you can use the
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::generateUrl`
method, which calls the router service's
:method:`Symfony\\Component\\Routing\\Router::generate` method.
you can use the ``router`` service's
:method:`Symfony\\Component\\Routing\\Router::generate` method::

$url = $this->get('router')->generate(
'blog_show',
array('slug' => 'my-blog-post')
);

In an upcoming section, you'll learn how to generate URLs from inside templates.

Expand Down

0 comments on commit 26f9e3b

Please sign in to comment.