Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Deprecate bundle:controller:action and service:method notation #26085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove deprecated controller syntax handling from debug:router
  • Loading branch information
Tobion committed Feb 19, 2018
commit 8b2069e710c5d612be65b857a5c45fb2830a79d5
47 changes: 0 additions & 47 deletions 47 src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
namespace Symfony\Bundle\FrameworkBundle\Command;

use Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Routing\Route;

/**
* A console command for retrieving information about routes.
Expand Down Expand Up @@ -83,20 +80,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
throw new \InvalidArgumentException(sprintf('The route "%s" does not exist.', $name));
}

$callable = $this->extractCallable($route);

$helper->describe($io, $route, array(
'format' => $input->getOption('format'),
'raw_text' => $input->getOption('raw'),
'name' => $name,
'output' => $io,
'callable' => $callable,
));
} else {
foreach ($routes as $route) {
$this->convertController($route);
}

$helper->describe($io, $routes, array(
'format' => $input->getOption('format'),
'raw_text' => $input->getOption('raw'),
Expand All @@ -105,41 +95,4 @@ protected function execute(InputInterface $input, OutputInterface $output)
));
}
}

private function convertController(Route $route)
{
if ($route->hasDefault('_controller')) {
$nameParser = new ControllerNameParser($this->getApplication()->getKernel());
try {
$route->setDefault('_controller', $nameParser->build($route->getDefault('_controller')));
} catch (\InvalidArgumentException $e) {
}
}
}

private function extractCallable(Route $route)
{
if (!$route->hasDefault('_controller')) {
return;
}

$controller = $route->getDefault('_controller');

if (1 === substr_count($controller, ':')) {
list($service, $method) = explode(':', $controller);
try {
return sprintf('%s::%s', get_class($this->getApplication()->getKernel()->getContainer()->get($service)), $method);
} catch (ServiceNotFoundException $e) {
}
}

$nameParser = new ControllerNameParser($this->getApplication()->getKernel());
try {
$shortNotation = $nameParser->build($controller);
$route->setDefault('_controller', $shortNotation);

return $controller;
} catch (\InvalidArgumentException $e) {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ protected function describeRoute(Route $route, array $options = array())
array('Defaults', $this->formatRouterConfig($route->getDefaults())),
array('Options', $this->formatRouterConfig($route->getOptions())),
);
if (isset($options['callable'])) {
$tableRows[] = array('Callable', $options['callable']);
}

$table = new Table($this->getOutput());
$table->setHeaders($tableHeaders)->setRows($tableRows);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.