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