added route debug information when path matches url

included required class
This commit is contained in:
inmarelibero 2013-02-02 16:51:31 +01:00 committed by Fabien Potencier
parent 1d778cf5c8
commit c46e3e1748

View File

@ -14,6 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\Command;
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 @@ EOF
$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']));