Created
January 17, 2020 15:44
-
-
Save krukru/89e0dca9110d7a4a771f7faef001e3ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// src/Service/SomeService.php | |
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | |
class SomeService | |
{ | |
private $router; | |
public function __construct(UrlGeneratorInterface $router) | |
{ | |
$this->router = $router; | |
} | |
public function someMethod() | |
{ | |
$url = $this->router->generate( | |
'my_unique_route_name' | |
); | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment