[FrameworkBundle] changed the router:debug to use the shortcut notation for the controller
This commit is contained in:
parent
d997dfa556
commit
1d210f86a6
@ -17,6 +17,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
/**
|
||||
* A console command for retrieving information about routes
|
||||
@ -80,6 +81,7 @@ EOF
|
||||
if (!$route) {
|
||||
throw new \InvalidArgumentException(sprintf('The route "%s" does not exist.', $name));
|
||||
}
|
||||
$this->convertController($route);
|
||||
$helper->describe($output, $route, array(
|
||||
'format' => $input->getOption('format'),
|
||||
'raw_text' => $input->getOption('raw'),
|
||||
@ -87,6 +89,11 @@ EOF
|
||||
));
|
||||
} else {
|
||||
$routes = $this->getContainer()->get('router')->getRouteCollection();
|
||||
|
||||
foreach ($routes as $route) {
|
||||
$this->convertController($route);
|
||||
}
|
||||
|
||||
$helper->describe($output, $routes, array(
|
||||
'format' => $input->getOption('format'),
|
||||
'raw_text' => $input->getOption('raw'),
|
||||
@ -94,4 +101,15 @@ EOF
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private function convertController(Route $route)
|
||||
{
|
||||
$nameParser = $this->getContainer()->get('controller_name_converter');
|
||||
if ($route->hasDefault('_controller')) {
|
||||
try {
|
||||
$route->setDefault('_controller', $nameParser->build($route->getDefault('_controller')));
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,15 +35,12 @@ class TextDescriptor extends Descriptor
|
||||
);
|
||||
|
||||
if ($showControllers) {
|
||||
$defaultData = $route->getDefaults();
|
||||
$controller = $defaultData['_controller'] ? $defaultData['_controller'] : '';
|
||||
$controller = $route->getDefault('_controller');
|
||||
if ($controller instanceof \Closure) {
|
||||
$controller = 'Closure';
|
||||
} else {
|
||||
if (is_object($controller)) {
|
||||
} elseif (is_object($controller)) {
|
||||
$controller = get_class($controller);
|
||||
}
|
||||
}
|
||||
$row[] = $controller;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user