use Table instead of the deprecated TableHelper

This commit is contained in:
Christian Flothmann 2014-12-13 10:50:51 +01:00
parent 7eaecbb78c
commit c5ad74d4ba
4 changed files with 33 additions and 15 deletions

View File

@ -1,6 +1,13 @@
UPGRADE FROM 2.4 to 2.5
=======================
FrameworkBundle
---------------
* The `Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor::renderTable()`
method expects the table to be an instance of `Symfony\Component\Console\Helper\Table`
instead of `Symfony\Component\Console\Helper\TableHelper`.
Routing
-------

View File

@ -12,7 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
use Symfony\Component\Console\Descriptor\DescriptorInterface;
use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@ -71,6 +71,16 @@ abstract class Descriptor implements DescriptorInterface
}
}
/**
* Returns the output.
*
* @return OutputInterface The output
*/
protected function getOutput()
{
return $this->output;
}
/**
* Writes content to output.
*
@ -85,17 +95,18 @@ abstract class Descriptor implements DescriptorInterface
/**
* Writes content to output.
*
* @param TableHelper $table
* @param bool $decorated
* @param Table $table
* @param bool $decorated
*/
protected function renderTable(TableHelper $table, $decorated = false)
protected function renderTable(Table $table, $decorated = false)
{
if (!$decorated) {
$table->setCellRowFormat('%s');
$table->setCellHeaderFormat('%s');
$table->getStyle()->setCellRowFormat('%s');
$table->getStyle()->setCellRowContentFormat('%s');
$table->getStyle()->setCellHeaderFormat('%s');
}
$table->render($this->output);
$table->render();
}
/**

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@ -31,8 +31,8 @@ class TextDescriptor extends Descriptor
{
$showControllers = isset($options['show_controllers']) && $options['show_controllers'];
$headers = array('Name', 'Method', 'Scheme', 'Host', 'Path');
$table = new TableHelper();
$table->setLayout(TableHelper::LAYOUT_COMPACT);
$table = new Table($this->getOutput());
$table->setStyle('compact');
$table->setHeaders($showControllers ? array_merge($headers, array('Controller')) : $headers);
foreach ($routes->all() as $name => $route) {
@ -99,8 +99,8 @@ class TextDescriptor extends Descriptor
*/
protected function describeContainerParameters(ParameterBag $parameters, array $options = array())
{
$table = new TableHelper();
$table->setLayout(TableHelper::LAYOUT_COMPACT);
$table = new Table($this->getOutput());
$table->setStyle('compact');
$table->setHeaders(array('Parameter', 'Value'));
foreach ($this->sortParameters($parameters) as $parameter => $value) {
@ -200,8 +200,8 @@ class TextDescriptor extends Descriptor
$tagsCount = count($maxTags);
$tagsNames = array_keys($maxTags);
$table = new TableHelper();
$table->setLayout(TableHelper::LAYOUT_COMPACT);
$table = new Table($this->getOutput());
$table->setStyle('compact');
$table->setHeaders(array_merge(array('Service ID'), $tagsNames, array('Scope', 'Class name')));
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {

View File

@ -33,7 +33,7 @@
},
"require-dev": {
"symfony/browser-kit": "~2.4",
"symfony/console": "~2.4,>=2.4.8",
"symfony/console": "~2.5,>=2.5.2",
"symfony/css-selector": "~2.0,>=2.0.5",
"symfony/dom-crawler": "~2.0,>=2.0.5",
"symfony/finder": "~2.0,>=2.0.5",