Skip to content

Commit 98c3fe7

Browse files
committed
feature #10365 [Console] deprecated TableHelper in favor of Table (fabpot)
This PR was merged into the 2.5-dev branch. Discussion ---------- [Console] deprecated TableHelper in favor of Table | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #9788, #9680, #9325 | License | MIT | Doc PR | symfony/symfony-docs#3627 This PR makes the Table helper stateless. It also adds a way to define global styles and to change/tweak existing styles easily. The second commit adds the possibility to add a separator anywhere in the table output. Commits ------- 21784ce [Console] make it possible to pass a style directly to Table::setStyle() 14caaec [Console] added the possibility to insert a table separator anywhere in a table output 39c495f [Console] deprecated TableHelper in favor of Table
2 parents 77bfac7 + 21784ce commit 98c3fe7

File tree

7 files changed

+1105
-276
lines changed

7 files changed

+1105
-276
lines changed

UPGRADE-3.0.md

+36
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,42 @@ UPGRADE FROM 2.x to 3.0
4848
}
4949
```
5050

51+
* `TableHelper` has been removed in favor of `Table`.
52+
53+
Before:
54+
55+
```
56+
$table = $app->getHelperSet()->get('table');
57+
$table
58+
->setHeaders(array('ISBN', 'Title', 'Author'))
59+
->setRows(array(
60+
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
61+
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
62+
array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
63+
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
64+
))
65+
;
66+
$table->render($output);
67+
```
68+
69+
After:
70+
71+
```
72+
use Symfony\Component\Console\Helper\Table;
73+
74+
$table = new Table($output);
75+
$table
76+
->setHeaders(array('ISBN', 'Title', 'Author'))
77+
->setRows(array(
78+
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
79+
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
80+
array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
81+
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
82+
))
83+
;
84+
$table->render();
85+
```
86+
5187
### EventDispatcher
5288

5389
* The interface `Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface`

src/Symfony/Component/Console/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
2.5.0
55
-----
66

7+
* deprecated TableHelper in favor of Table
78
* deprecated ProgressHelper in favor of ProgressBar
89
* added a way to set a default command instead of `ListCommand`
910
* added a way to set the process name of a command

0 commit comments

Comments
 (0)