Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit26f9e3b

Browse files
committed
[book] [routing] fixed a note that wasn't properly updated
Previously, the code used the generate() method of the service andthe note explained the generateUrl() method of the base controller.Then, the example was updated to use the generateUrl(), but thenote kept explaining the generateUrl(). This change is just aboutexplaining in the note the alterantive generate() method of the service.
1 parent355cd5b commit26f9e3b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎book/routing.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,12 +1168,15 @@ route. With this information, any URL can easily be generated::
11681168

11691169
..note::
11701170

1171-
In controllers that extend Symfony's base
1171+
In controllers thatdon'textend Symfony's base
11721172
:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller`,
1173-
you can use the
1174-
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::generateUrl`
1175-
method, which calls the router service's
1176-
:method:`Symfony\\Component\\Routing\\Router::generate` method.
1173+
you can use the ``router`` service's
1174+
:method:`Symfony\\Component\\Routing\\Router::generate` method::
1175+
1176+
$url = $this->get('router')->generate(
1177+
'blog_show',
1178+
array('slug' => 'my-blog-post')
1179+
);
11771180

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp