Skip to content

Commit c1fc868

Browse files
committed
Improved the example to generate URLs in the console
1 parent 2d29c07 commit c1fc868

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

console/request_context.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@ from the ``router`` service and override its settings::
7272
{
7373
protected function execute(InputInterface $input, OutputInterface $output)
7474
{
75-
$context = $this->getContainer()->get('router')->getContext();
75+
$router = $this->getContainer()->get('router');
76+
$context = $router->getContext();
7677
$context->setHost('example.com');
7778
$context->setScheme('https');
7879
$context->setBaseUrl('my/path');
7980

80-
// ... your code here
81+
$url = $router->generate('route-name', array('param-name' => 'param-value'));
82+
// ...
8183
}
8284
}

0 commit comments

Comments
 (0)