8000 minor #12970 [FrameworkBundle] use Table instead of the deprecated Ta… · symfony/symfony@e11f8b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit e11f8b4

Browse files
committed
minor #12970 [FrameworkBundle] use Table instead of the deprecated TableHelper (xabbuh)
This PR was merged into the 2.5 branch. Discussion ---------- [FrameworkBundle] use Table instead of the deprecated TableHelper | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- c5ad74d use Table instead of the deprecated TableHelper
2 parents 987717e + c5ad74d commit e11f8b4

File tree

4 files changed

+33
-15
lines changed

4 files changed

+33
-15
lines changed

UPGRADE-2.5.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
UPGRADE FROM 2.4 to 2.5
22
=======================
33

4+
FrameworkBundle
5+
---------------
6+
7+
* The `Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor::renderTable()`
8+
method expects the table to be an instance of `Symfony\Component\Console\Helper\Table`
9+
instead of `Symfony\Component\Console\Helper\TableHelper`.
10+
411
Routing
512
-------
613

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
1313

1414
use Symfony\Component\Console\Descriptor\DescriptorInterface;
15-
use Symfony\Component\Console\Helper\TableHelper;
15+
use Symfony\Component\Console\Helper\Table;
1616
use Symfony\Component\Console\Output\OutputInterface;
1717
use Symfony\Component\DependencyInjection\Alias;
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -71,6 +71,16 @@ public function describe(OutputInterface $output, $object, array $options = arra
7171
}
7272
}
7373

74+
/**
75+
* Returns the output.
76+
*
77+
* @return OutputInterface The output
78+
*/
79+
protected function getOutput()
80+
{
81+
return $this->output;
82+
}
83+
7484
/**
7585
* Writes content to output.
7686
*
@@ -85,17 +95,18 @@ protected function write($content, $decorated = false)
8595
/**
8696
* Writes content to output.
8797
*
88-
* @param TableHelper $table
89-
* @param bool $decorated
98+
* @param Table $table
99+
* @param bool $decorated
90100
*/
91-
protected function renderTable(TableHelper $table, $decorated = false)
101+
protected function renderTable(Table $table, $decorated = false)
92102
{
93103
if (!$decorated) {
94-
$table->setCellRowFormat('%s');
95-
$table->setCellHeaderFormat('%s');
104+
$table->getStyle()->setCellRowFormat('%s');
105+
$table->getStyle()->setCellRowContentFormat('%s');
106+
$table->getStyle()->setCellHeaderFormat('%s');
96107
}
97108

98-
$table->render($this->output);
109+
$table->render();
99110
}
100111

101112
/**

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
1313

14-
use Symfony\Component\Console\Helper\TableHelper;
14+
use Symfony\Component\Console\Helper\Table;
1515
use Symfony\Component\DependencyInjection\Alias;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\DependencyInjection\Definition;
@@ -31,8 +31,8 @@ protected function describeRouteCollection(RouteCollection $routes, array $optio
3131
{
3232
$showControllers = isset($options['show_controllers']) && $options['show_controllers'];
3333
$headers = array('Name', 'Method', 'Scheme', 'Host', 'Path');
34-
$table = new TableHelper();
35-
$table->setLayout(TableHelper::LAYOUT_COMPACT);
34+
$table = new Table($this->getOutput());
35+
$table->setStyle('compact');
3636
$table->setHeaders($showControllers ? array_merge($headers, array('Controller')) : $headers);
3737

3838
foreach ($routes->all() as $name => $route) {
@@ -99,8 +99,8 @@ protected function describeRoute(Route $route, array $options = array())
9999
*/
100100
protected function describeContainerParameters(ParameterBag $parameters, array $options = array())
101101
{
102-
$table = new TableHelper();
103-
$table->setLayout(TableHelper::LAYOUT_COMPACT);
102+
$table = new Table($this->getOutput());
103+
$table->setStyle('compact');
104104
$table->setHeaders(array('Parameter', 'Value'));
105105

106106
foreach ($this->sortParameters($parameters) as $parameter => $value) {
@@ -200,8 +200,8 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
200200
$tagsCount = count($maxTags);
201201
$tagsNames = array_keys($maxTags);
202202

203-
$table = new TableHelper();
204-
$table->setLayout(TableHelper::LAYOUT_COMPACT);
203+
$table = new Table($this->getOutput());
204+
$table->setStyle('compact');
205205
$table->setHeaders(array_merge(array('Service ID'), $tagsNames, array('Scope', 'Class name')));
206206

207207
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"require-dev": {
3535
"symfony/browser-kit": "~2.4",
36-
"symfony/console": "~2.4,>=2.4.8",
36+
"symfony/console": "~2.5,>=2.5.2",
3737
"symfony/css-selector": "~2.0,>=2.0.5",
3838
"symfony/dom-crawler": "~2.0,>=2.0.5",
3939
"symfony/finder": "~2.0,>=2.0.5",

0 commit comments

Comments
 (0)
0