bug #10443 [FrameworkBundle] Use DIC parameter as default host value if available (romainneutron)
This PR was merged into the 2.5-dev branch.
Discussion
----------
[FrameworkBundle] Use DIC parameter as default host value if available
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
This follows #10439
Commits
-------
85a2fbf
[FrameworkBundle] Use DIC parameter as default host value if available
This commit is contained in:
commit
120a7e99d7
@ -51,8 +51,8 @@ class RouterMatchCommand extends ContainerAwareCommand
|
|||||||
->setName('router:match')
|
->setName('router:match')
|
||||||
->setDefinition(array(
|
->setDefinition(array(
|
||||||
new InputArgument('path_info', InputArgument::REQUIRED, 'A path info'),
|
new InputArgument('path_info', InputArgument::REQUIRED, 'A path info'),
|
||||||
new InputOption('method', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP method', 'GET'),
|
new InputOption('method', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP method'),
|
||||||
new InputOption('host', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP host', 'localhost'),
|
new InputOption('host', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP host'),
|
||||||
))
|
))
|
||||||
->setDescription('Helps debug routes by simulating a path info match')
|
->setDescription('Helps debug routes by simulating a path info match')
|
||||||
->setHelp(<<<EOF
|
->setHelp(<<<EOF
|
||||||
@ -74,8 +74,12 @@ EOF
|
|||||||
{
|
{
|
||||||
$router = $this->getContainer()->get('router');
|
$router = $this->getContainer()->get('router');
|
||||||
$context = $router->getContext();
|
$context = $router->getContext();
|
||||||
$context->setMethod($input->getOption('method'));
|
if (null !== $method = $input->getOption('method')) {
|
||||||
$context->setHost($input->getOption('host'));
|
$context->setMethod($method);
|
||||||
|
}
|
||||||
|
if (null !== $host = $input->getOption('host')) {
|
||||||
|
$context->setHost($host);
|
||||||
|
}
|
||||||
|
|
||||||
$matcher = new TraceableUrlMatcher($router->getRouteCollection(), $context);
|
$matcher = new TraceableUrlMatcher($router->getRouteCollection(), $context);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user