@@ -2415,7 +2415,7 @@ the :class:`Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface` class
2415
2415
class SomeService
2416
2416
{
2417
2417
public function __construct(
2418
- private UrlGeneratorInterface $router ,
2418
+ private UrlGeneratorInterface $urlGenerator ,
2419
2419
) {
2420
2420
}
2421
2421
@@ -2424,20 +2424,20 @@ the :class:`Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface` class
2424
2424
// ...
2425
2425
2426
2426
// generate a URL with no route arguments
2427
- $signUpPage = $this->router ->generate('sign_up');
2427
+ $signUpPage = $this->urlGenerator ->generate('sign_up');
2428
2428
2429
2429
// generate a URL with route arguments
2430
- $userProfilePage = $this->router ->generate('user_profile', [
2430
+ $userProfilePage = $this->urlGenerator ->generate('user_profile', [
2431
2431
'username' => $user->getUserIdentifier(),
2432
2432
]);
2433
2433
2434
2434
// generated URLs are "absolute paths" by default. Pass a third optional
2435
2435
// argument to generate different URLs (e.g. an "absolute URL")
2436
- $signUpPage = $this->router ->generate('sign_up', [], UrlGeneratorInterface::ABSOLUTE_URL);
2436
+ $signUpPage = $this->urlGenerator ->generate('sign_up', [], UrlGeneratorInterface::ABSOLUTE_URL);
2437
2437
2438
2438
// when a route is localized, Symfony uses by default the current request locale
2439
2439
// pass a different '_locale' value if you want to set the locale explicitly
2440
- $signUpPageInDutch = $this->router ->generate('sign_up', ['_locale' => 'nl']);
2440
+ $signUpPageInDutch = $this->urlGenerator ->generate('sign_up', ['_locale' => 'nl']);
2441
2441
}
2442
2442
}
2443
2443
0 commit comments