8000 Merge branch '7.1' into 7.2 · symfony/symfony-docs@577b39f · GitHub
[go: up one dir, main page]

Skip to content

Commit 577b39f

Browse files
committed
Merge branch '7.1' into 7.2
* 7.1: Rename variable to stay consistent
2 parents b4846b8 + d10f5bc commit 577b39f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

routing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,7 +2372,7 @@ the :class:`Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface` class
23722372
class SomeService
23732373
{
23742374
public function __construct(
2375-
private UrlGeneratorInterface $router,
2375+
private UrlGeneratorInterface $urlGenerator,
23762376
) {
23772377
}
23782378

@@ -2381,20 +2381,20 @@ the :class:`Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface` class
23812381
// ...
23822382

23832383
// generate a URL with no route arguments
2384-
$signUpPage = $this->router->generate('sign_up');
2384+
$signUpPage = $this->urlGenerator->generate('sign_up');
23852385

23862386
// generate a URL with route arguments
2387-
$userProfilePage = $this->router->generate('user_profile', [
2387+
$userProfilePage = $this->urlGenerator->generate('user_profile', [
23882388
'username' => $user->getUserIdentifier(),
23892389
]);
23902390

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

23952395
// when a route is localized, Symfony uses by default the current request locale
23962396
// pass a different '_locale' value if you want to set the locale explicitly
2397-
$signUpPageInDutch = $this->router->generate('sign_up', ['_locale' => 'nl']);
2397+
$signUpPageInDutch = $this->urlGenerator->generate('sign_up', ['_locale' => 'nl']);
23982398
}
23992399
}
24002400

0 commit comments

Comments
 (0)
0