22
22
use Doctrine \ORM \EntityManagerInterface ;
23
23
use Symfony \Component \Console \Attribute \AsCommand ;
24
24
use Symfony \Component \Console \Command \Command ;
25
+ use Symfony \Component \Console \Helper \ProgressIndicator ;
25
26
use Symfony \Component \Console \Input \InputInterface ;
26
27
use Symfony \Component \Console \Output \OutputInterface ;
27
28
use Symfony \Component \Console \Style \SymfonyStyle ;
@@ -38,13 +39,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int
38
39
{
39
40
$ io = new SymfonyStyle ($ input , $ output );
40
41
41
- $ this ->clearEntity (Chat::class, $ io );
42
- $ this ->clearEntity (TodoItem::class, $ io );
43
- $ this ->clearEntity (TodoList::class, $ io );
44
- $ this ->clearEntity (InvoiceItem::class, $ io );
45
- $ this ->clearEntity (Invoice::class, $ io );
46
- $ this ->growFood ($ io );
47
- $ this ->manufactureProducts ($ io );
42
+ $ progressIndicator = new ProgressIndicator ($ output , finishedIndicatorValue: '✅ ' );
43
+ try {
44
+ $ progressIndicator ->start ("Loading data " );
45
+ $ this ->clearEntity (Chat::class, $ io );
46
+ $ this ->clearEntity (TodoItem::class, $ io );
47
+ $ this ->clearEntity (TodoList::class, $ io );
48
+ $ this ->clearEntity (InvoiceItem::class, $ io );
49
+ $ this ->clearEntity (Invoice::class, $ io );
50
+ $ this ->growFood ($ io );
51
+ $ this ->manufactureProducts ($ io );
52
+ $ progressIndicator ->finish ('Finished ' );
53
+ } catch (\Exception ) {
54
+ $ progressIndicator ->finish ('Failed ' , '🚨 ' );
55
+ }
48
56
49
57
return Command::SUCCESS ;
50
58
}
0 commit comments