File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Frosh \MailArchive \Command ;
6+
7+ use Frosh \MailArchive \Messenger \CleanupMessage ;
8+ use Symfony \Component \Console \Attribute \AsCommand ;
9+ use Symfony \Component \Console \Command \Command ;
10+ use Symfony \Component \Console \Input \InputInterface ;
11+ use Symfony \Component \Console \Output \OutputInterface ;
12+ use Symfony \Component \Messenger \MessageBusInterface ;
13+
14+ #[AsCommand('frosh:mail-archive:cleanup ' , 'Cleanup old mail archive entries ' )]
15+ class CleanupCommand extends Command
16+ {
17+ public function __construct (
18+ private readonly MessageBusInterface $ messageBus ,
19+
20+ ) {
21+ parent ::__construct ();
22+ }
23+
24+ protected function execute (InputInterface $ input , OutputInterface $ output ): int
25+ {
26+ $ output ->writeln ('Dispatching mail archive cleanup... ' );
27+
28+ $ this ->messageBus ->dispatch (new CleanupMessage ());
29+
30+ $ output ->writeln ('Cleanup message dispatched successfully. ' );
31+
32+ return Command::SUCCESS ;
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments