From 688556abdcfa995298a2cb95fb57c0916f90df23 Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Mon, 11 Nov 2024 07:54:59 -0500 Subject: [PATCH 1/2] add the new ProgressIndicator --- .../src/Command/LoadDataCommand.php | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ux.symfony.com/src/Command/LoadDataCommand.php b/ux.symfony.com/src/Command/LoadDataCommand.php index b27a8e7139d..96566fdcf4f 100644 --- a/ux.symfony.com/src/Command/LoadDataCommand.php +++ b/ux.symfony.com/src/Command/LoadDataCommand.php @@ -22,6 +22,7 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Helper\ProgressIndicator; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; @@ -38,13 +39,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); - $this->clearEntity(Chat::class, $io); - $this->clearEntity(TodoItem::class, $io); - $this->clearEntity(TodoList::class, $io); - $this->clearEntity(InvoiceItem::class, $io); - $this->clearEntity(Invoice::class, $io); - $this->growFood($io); - $this->manufactureProducts($io); + $progressIndicator = new ProgressIndicator($output, finishedIndicatorValue: '✅'); + try { + $progressIndicator->start("Loading data"); + $this->clearEntity(Chat::class, $io); + $this->clearEntity(TodoItem::class, $io); + $this->clearEntity(TodoList::class, $io); + $this->clearEntity(InvoiceItem::class, $io); + $this->clearEntity(Invoice::class, $io); + $this->growFood($io); + $this->manufactureProducts($io); + $progressIndicator->finish('Finished'); + } catch (\Exception) { + $progressIndicator->finish('Failed', '🚨'); + } return Command::SUCCESS; } From 475fc4fe6736ecb18ac8a64c566bcceb649a1298 Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Mon, 11 Nov 2024 12:41:16 -0500 Subject: [PATCH 2/2] Update ux.symfony.com/src/Command/LoadDataCommand.php Co-authored-by: Hugo Alliaume --- .../src/Command/LoadDataCommand.php | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/ux.symfony.com/src/Command/LoadDataCommand.php b/ux.symfony.com/src/Command/LoadDataCommand.php index 96566fdcf4f..f3d85c6b920 100644 --- a/ux.symfony.com/src/Command/LoadDataCommand.php +++ b/ux.symfony.com/src/Command/LoadDataCommand.php @@ -40,19 +40,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io = new SymfonyStyle($input, $output); $progressIndicator = new ProgressIndicator($output, finishedIndicatorValue: '✅'); - try { - $progressIndicator->start("Loading data"); - $this->clearEntity(Chat::class, $io); - $this->clearEntity(TodoItem::class, $io); - $this->clearEntity(TodoList::class, $io); - $this->clearEntity(InvoiceItem::class, $io); - $this->clearEntity(Invoice::class, $io); - $this->growFood($io); - $this->manufactureProducts($io); - $progressIndicator->finish('Finished'); - } catch (\Exception) { - $progressIndicator->finish('Failed', '🚨'); - } + $progressIndicator->start("Loading data"); + $this->clearEntity(Chat::class, $io); + $this->clearEntity(TodoItem::class, $io); + $this->clearEntity(TodoList::class, $io); + $this->clearEntity(InvoiceItem::class, $io); + $this->clearEntity(Invoice::class, $io); + $this->growFood($io); + $this->manufactureProducts($io); + $progressIndicator->finish('Finished'); return Command::SUCCESS; }