[FrameworkBundle] improve usage of Table helper
Use the `Table` helper if present in favor of the deprecated `TableHelper` class.
This commit is contained in:
parent
234cebd087
commit
71d84e66e4
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||||
|
|
||||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||||
|
use Symfony\Component\Console\Helper\Table;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||||
|
|
||||||
@ -28,14 +29,23 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
|
|||||||
{
|
{
|
||||||
$output->writeln('Available registered bundles with their extension alias if available:');
|
$output->writeln('Available registered bundles with their extension alias if available:');
|
||||||
|
|
||||||
$table = $this->getHelperSet()->get('table');
|
if (class_exists('Symfony\Component\Console\Helper\Table')) {
|
||||||
|
$table = new Table($output);
|
||||||
|
} else {
|
||||||
|
$table = $this->getHelperSet()->get('table');
|
||||||
|
}
|
||||||
|
|
||||||
$table->setHeaders(array('Bundle name', 'Extension alias'));
|
$table->setHeaders(array('Bundle name', 'Extension alias'));
|
||||||
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
|
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
|
||||||
$extension = $bundle->getContainerExtension();
|
$extension = $bundle->getContainerExtension();
|
||||||
$table->addRow(array($bundle->getName(), $extension ? $extension->getAlias() : ''));
|
$table->addRow(array($bundle->getName(), $extension ? $extension->getAlias() : ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->render($output);
|
if (class_exists('Symfony\Component\Console\Helper\Table')) {
|
||||||
|
$table->render();
|
||||||
|
} else {
|
||||||
|
$table->render($output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function findExtension($name)
|
protected function findExtension($name)
|
||||||
|
@ -131,8 +131,11 @@ EOF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var \Symfony\Component\Console\Helper\Table $table */
|
if (class_exists('Symfony\Component\Console\Helper\Table')) {
|
||||||
$table = new Table($output);
|
$table = new Table($output);
|
||||||
|
} else {
|
||||||
|
$table = $this->getHelperSet()->get('table');
|
||||||
|
}
|
||||||
|
|
||||||
// Display header line
|
// Display header line
|
||||||
$headers = array('State(s)', 'Id', sprintf('Message Preview (%s)', $locale));
|
$headers = array('State(s)', 'Id', sprintf('Message Preview (%s)', $locale));
|
||||||
@ -177,7 +180,11 @@ EOF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->render();
|
if (class_exists('Symfony\Component\Console\Helper\Table')) {
|
||||||
|
$table->render();
|
||||||
|
} else {
|
||||||
|
$table->render($output);
|
||||||
|
}
|
||||||
|
|
||||||
$output->writeln('');
|
$output->writeln('');
|
||||||
$output->writeln('<info>Legend:</info>');
|
$output->writeln('<info>Legend:</info>');
|
||||||
|
Reference in New Issue
Block a user