Skip to content

Commit

Permalink
feature #10365 [Console] deprecated TableHelper in favor of Table (fa…
Browse files Browse the repository at this point in the history
…bpot)

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
  • Loading branch information
fabpot committed Mar 3, 2014
2 parents 77bfac7 + 21784ce commit 98c3fe7
Show file tree
Hide file tree
Showing 7 changed files with 1,105 additions and 276 deletions.
36 changes: 36 additions & 0 deletions UPGRADE-3.0.md
Expand Up @@ -48,6 +48,42 @@ UPGRADE FROM 2.x to 3.0
}
```

* `TableHelper` has been removed in favor of `Table`.

Before:

```
$table = $app->getHelperSet()->get('table');
$table
->setHeaders(array('ISBN', 'Title', 'Author'))
->setRows(array(
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
))
;
$table->render($output);
```

After:

```
use Symfony\Component\Console\Helper\Table;
$table = new Table($output);
$table
->setHeaders(array('ISBN', 'Title', 'Author'))
->setRows(array(
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
))
;
$table->render();
```

### EventDispatcher

* The interface `Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface`
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Console/CHANGELOG.md
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
2.5.0
-----

* deprecated TableHelper in favor of Table
* deprecated ProgressHelper in favor of ProgressBar
* added a way to set a default command instead of `ListCommand`
* added a way to set the process name of a command
Expand Down

0 comments on commit 98c3fe7

Please sign in to comment.