@@ -25,18 +25,25 @@ To display a table, use :class:`Symfony\\Component\\Console\\Helper\\Table`,
2525set the headers, set the rows and then render the table::
2626
2727 use Symfony\Component\Console\Helper\Table;
28-
29- $table = new Table($output);
30- $table
31- ->setHeaders(array('ISBN', 'Title', 'Author'))
32- ->setRows(array(
33- array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
34- array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
35- array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
36- array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
37- ))
38- ;
39- $table->render();
28+ // ...
29+
30+ class SomeCommand extends Command
31+ {
32+ public function execute(InputInterface $input, OutputInterface $output)
33+ {
34+ $table = new Table($output);
35+ $table
36+ ->setHeaders(array('ISBN', 'Title', 'Author'))
37+ ->setRows(array(
38+ array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
39+ array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
40+ array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
41+ array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
42+ ))
43+ ;
44+ $table->render();
45+ }
46+ }
4047
4148You can add a table separator anywhere in the output by passing an instance of
4249:class: `Symfony\\ Component\\ Console\\ Helper\\ TableSeparator ` as a row::
0 commit comments