Browse files

merged branch inmarelibero/2.2-RouterMatch (PR #6950)

This PR was submitted for the 2.2 branch but it was merged into the master branch instead (closes #6950).

Discussion
----------

[2.3] [FrameworkBundle] added route debug information when path matches url

the result of the command `app/console router:match /demo/hello/foo` would be:

![Schermata 02-2456326 alle 17 04 42](https://f.cloud.github.com/assets/254808/120934/a1499432-6d52-11e2-8b67-46a164c30ea0.png)

instead of just:

    Route "_demo_hello" matches

Commits
-------

36098e1 [FrameworkBundle] added route debug information when path matches url
  • Loading branch information...
2 parents 1d778cf + c46e3e1 commit 3b1147ed064f2ed67a1a415a0ceaf2dc24596169 @fabpot fabpot committed Mar 23, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php
View
6 src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php
@@ -14,6 +14,7 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;
@@ -76,6 +77,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf('<fg=yellow>Route "%s" almost matches but %s</>', $trace['name'], lcfirst($trace['log'])));
} elseif (TraceableUrlMatcher::ROUTE_MATCHES == $trace['level']) {
$output->writeln(sprintf('<fg=green>Route "%s" matches</>', $trace['name']));
+
+ $routerDebugcommand = $this->getApplication()->find('router:debug');
+ $output->writeln('');
+ $routerDebugcommand->run(new ArrayInput(array('name' => $trace['name'])), $output);
+
$matches = true;
} elseif ($input->getOption('verbose')) {
$output->writeln(sprintf('Route "%s" does not match: %s', $trace['name'], $trace['log']));

0 comments on commit 3b1147e

Please sign in to comment.