mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 04:37:42 +08:00
Allow \yii\console\widgets\Table to render empty table (#16865)
When headers provided but no columns. Ref #16858
This commit is contained in:
committed by
Alexander Makarov
parent
1fe3d61a3b
commit
e11e3eb4c5
@ -82,6 +82,7 @@ Yii Framework 2 Change Log
|
||||
- Enh #16839: Increase frequency of lock tries for `yii\mutex\FileMutex::acquireLock()` when $timeout is provided (rob006)
|
||||
- Enh #16839: Add support for `$timeout` in `yii\mutex\PgsqlMutex::acquire()` (rob006)
|
||||
- Bug #16828: `yii\console\controllers\MessageController::translator` recognized object' methods and functions calls as identical sets of tokens (erickskrauch)
|
||||
- Bug #16858: Allow `\yii\console\widgets\Table` to render empty table when headers provided but no columns (damiandziaduch)
|
||||
|
||||
|
||||
2.0.15.1 March 21, 2018
|
||||
|
||||
@ -310,7 +310,11 @@ class Table extends Widget
|
||||
$screenWidth = $this->getScreenWidth() - self::CONSOLE_SCROLLBAR_OFFSET;
|
||||
|
||||
$headerCount = count($this->_headers);
|
||||
$rowColCount = max(array_map('count', $this->_rows));
|
||||
if (empty($this->_rows)) {
|
||||
$rowColCount = 0;
|
||||
} else {
|
||||
$rowColCount = max(array_map('count', $this->_rows));
|
||||
}
|
||||
$count = max($headerCount, $rowColCount);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$columns[] = ArrayHelper::getColumn($this->_rows, $i);
|
||||
|
||||
Reference in New Issue
Block a user