1616use CleverAge \ProcessBundle \Event \ConsoleProcessEvent ;
1717use CleverAge \ProcessBundle \Filesystem \JsonStreamFile ;
1818use CleverAge \ProcessBundle \Manager \ProcessManager ;
19+ use CleverAge \ProcessBundle \Registry \ProcessConfigurationRegistry ;
1920use Psr \EventDispatcher \EventDispatcherInterface ;
21+ use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
2022use Symfony \Component \Console \Attribute \AsCommand ;
2123use Symfony \Component \Console \Command \Command ;
2224use Symfony \Component \Console \Input \InputArgument ;
@@ -40,7 +42,8 @@ class ExecuteProcessCommand extends Command
4042
4143 public function __construct (
4244 protected ProcessManager $ processManager ,
43- protected EventDispatcherInterface $ eventDispatcher
45+ protected EventDispatcherInterface $ eventDispatcher ,
46+ protected ProcessConfigurationRegistry $ processRegistry ,
4447 ) {
4548 parent ::__construct ();
4649 }
@@ -86,6 +89,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8689 $ this ->eventDispatcher ->dispatch (new ConsoleProcessEvent ($ input , $ output , $ inputData , $ context ));
8790
8891 foreach ($ input ->getArgument ('processCodes ' ) as $ code ) {
92+ if (!$ this ->processRegistry ->hasProcessConfiguration ($ code )) {
93+ throw new InvalidConfigurationException ("Unknown process {$ code }" );
94+ }
95+
8996 if (!$ output ->isQuiet ()) {
9097 $ output ->writeln ("<comment>Starting process ' {$ code }'...</comment> " );
9198 }
0 commit comments