bug #21599 [Console][Table] fixed render when using multiple rowspans. (aitboudad)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console][Table] fixed render when using multiple rowspans.

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #21018
| License       | MIT
| Doc PR        | ~

Commits
-------

17e459e688 [Console][Table] fixed render when using multiple rowspans.
This commit is contained in:
Fabien Potencier 2017-02-16 04:36:16 -08:00
commit be854e16d5
2 changed files with 17 additions and 14 deletions

View File

@ -394,6 +394,9 @@ class Table
foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
$value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : ''; $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
$unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan())); $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
if ($nbLines === $unmergedRowKey - $line) {
break;
}
} }
} }
} }

View File

@ -298,10 +298,10 @@ TABLE
array( array(
array( array(
new TableCell('9971-5-0210-0', array('rowspan' => 3)), new TableCell('9971-5-0210-0', array('rowspan' => 3)),
'Divine Comedy', new TableCell('Divine Comedy', array('rowspan' => 2)),
'Dante Alighieri', 'Dante Alighieri',
), ),
array('A Tale of Two Cities', 'Charles Dickens'), array(),
array("The Lord of \nthe Rings", "J. R. \nR. Tolkien"), array("The Lord of \nthe Rings", "J. R. \nR. Tolkien"),
new TableSeparator(), new TableSeparator(),
array('80-902734-1-6', new TableCell("And Then \nThere \nWere None", array('rowspan' => 3)), 'Agatha Christie'), array('80-902734-1-6', new TableCell("And Then \nThere \nWere None", array('rowspan' => 3)), 'Agatha Christie'),
@ -309,18 +309,18 @@ TABLE
), ),
'default', 'default',
<<<'TABLE' <<<'TABLE'
+---------------+----------------------+-----------------+ +---------------+---------------+-----------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+---------------+----------------------+-----------------+ +---------------+---------------+-----------------+
| 9971-5-0210-0 | Divine Comedy | Dante Alighieri | | 9971-5-0210-0 | Divine Comedy | Dante Alighieri |
| | A Tale of Two Cities | Charles Dickens | | | | |
| | The Lord of | J. R. | | | The Lord of | J. R. |
| | the Rings | R. Tolkien | | | the Rings | R. Tolkien |
+---------------+----------------------+-----------------+ +---------------+---------------+-----------------+
| 80-902734-1-6 | And Then | Agatha Christie | | 80-902734-1-6 | And Then | Agatha Christie |
| 80-902734-1-7 | There | Test | | 80-902734-1-7 | There | Test |
| | Were None | | | | Were None | |
+---------------+----------------------+-----------------+ +---------------+---------------+-----------------+
TABLE TABLE
), ),