vendredi 21 février 2020

Using multiple Symfony ProgressBar in Laravel command

The use case is this: i have a main task working on some objects, and for each i have a second task to be run on chidrens of the current object, so i would like to display two progress bars.

I'm trying to display those progress bars in a Laravel 5.7 command, without any luck.

Laravel documentation do not explain how to output multiple progress bars, while Symfony documentation explain that it is possible using sections, so i made this in my command handle():

$output = new ConsoleOutput();

$this->section_1 = $output->section();
$this->section_2 = $output->section();

$this->bar_1 = new ProgressBar($this->section_1);
$this->bar_2 = new ProgressBar($this->section_2);

$this->bar_1->start(count($data));

The first bar is started immediately, while the second bar is started at each call of a second function with its current data.

Running the command just the first bar is displayed, can't find why the second one is not.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire