- $serviceCommandlist = $container->get('drush.service.consolidationcommands');
- foreach ($serviceCommandlist->getCommandList() as $commandhandler) {
- if (!$this->commandIgnored($commandhandler, $ignored_modules)) {
- drush_log(dt('Add a commandhandler: !name', ['!name' => get_class($commandhandler)]), LogLevel::DEBUG);
- annotationcommand_adapter_cache_module_service_commands($commandhandler);
+ if ($container->has('drush.service.consolidationcommands')) {
+ $serviceCommandlist = $container->get('drush.service.consolidationcommands');
+ foreach ($serviceCommandlist->getCommandList() as $commandhandler) {
+ if (!$this->commandIgnored($commandhandler, $ignored_modules)) {
+ drush_log(dt('Add a commandhandler: !name', ['!name' => get_class($commandhandler)]), LogLevel::DEBUG);
+ annotationcommand_adapter_cache_module_service_commands($commandhandler);
+ }