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

Commit0b5820f

Browse files
committed
Rename variable to stay consistent
1 parentefb4ecb commit0b5820f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎routing.rst‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2671,32 +2671,32 @@ the :class:`Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface` class
26712671

26722672
class SomeService
26732673
{
2674-
private $router;
2674+
private $urlGenerator;
26752675

2676-
public function __construct(UrlGeneratorInterface $router)
2676+
public function __construct(UrlGeneratorInterface $urlGenerator)
26772677
{
2678-
$this->router = $router;
2678+
$this->urlGenerator = $urlGenerator;
26792679
}
26802680

26812681
public function someMethod()
26822682
{
26832683
// ...
26842684

26852685
// generate a URL with no route arguments
2686-
$signUpPage = $this->router->generate('sign_up');
2686+
$signUpPage = $this->urlGenerator->generate('sign_up');
26872687

26882688
// generate a URL with route arguments
2689-
$userProfilePage = $this->router->generate('user_profile', [
2689+
$userProfilePage = $this->urlGenerator->generate('user_profile', [
26902690
'username' => $user->getUserIdentifier(),
26912691
]);
26922692

26932693
// generated URLs are "absolute paths" by default. Pass a third optional
26942694
// argument to generate different URLs (e.g. an "absolute URL")
2695-
$signUpPage = $this->router->generate('sign_up', [], UrlGeneratorInterface::ABSOLUTE_URL);
2695+
$signUpPage = $this->urlGenerator->generate('sign_up', [], UrlGeneratorInterface::ABSOLUTE_URL);
26962696

26972697
// when a route is localized, Symfony uses by default the current request locale
26982698
// pass a different '_locale' value if you want to set the locale explicitly
2699-
$signUpPageInDutch = $this->router->generate('sign_up', ['_locale' => 'nl']);
2699+
$signUpPageInDutch = $this->urlGenerator->generate('sign_up', ['_locale' => 'nl']);
27002700
}
27012701
}
27022702

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp