-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] use Table instead of the deprecated TableHelper #12970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; | ||
|
||
use Symfony\Component\Console\Descriptor\DescriptorInterface; | ||
use Symfony\Component\Console\Helper\TableHelper; | ||
use Symfony\Component\Console\Helper\Table; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\DependencyInjection\Alias; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
@@ -71,6 +71,16 @@ public function describe(OutputInterface $output, $object, array $options = arra | |
} | ||
} | ||
|
||
/** | ||
* Returns the output. | ||
* | ||
* @return OutputInterface The output | ||
*/ | ||
protected function getOutput() | ||
{ | ||
return $this->output; | ||
} | ||
|
||
/** | ||
* Writes content to output. | ||
* | ||
|
@@ -85,17 +95,18 @@ protected function write($content, $decorated = false) | |
/** | ||
* Writes content to output. | ||
* | ||
* @param TableHelper $table | ||
* @param bool $decorated | ||
* @param Table $table | ||
* @param bool $decorated | ||
*/ | ||
protected function renderTable(TableHelper $table, $decorated = false) | ||
protected function renderTable(Table $table, $decorated = false) | ||
{ | ||
if (!$decorated) { | ||
$table->setCellRowFormat('%s'); | ||
$table->setCellHeaderFormat('%s'); | ||
$table->getStyle()->setCellRowFormat('%s'); | ||
$table->getStyle()->setCellRowContentFormat('%s'); | ||
$table->getStyle()->setCellHeaderFormat('%s'); | ||
} | ||
|
||
$table->render($this->output); | ||
$table->render(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO the render method should also allow to pass the output as parameter (as it has been in TableHelper). It makes way more sense and then we don't need the protected There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current way of passing the output as constructor to the Table object makes not much sense. The table object is just a representation of a table. And a table is not bound to the ouput, just the rendering is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see your point. But shouldn't we move this discussion into a new issue? |
||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that changing the visibility of
$output
is enough.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the visibility makes it mutable. The methods allows us to keep the property read-only.