function DrupalApplication::addDrupalCommands

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Command/DrupalApplication.php \Drupal\Core\Command\DrupalApplication::addDrupalCommands()

Discovers commands that are provided by installed modules.

File

core/lib/Drupal/Core/Command/DrupalApplication.php, line 156

Class

DrupalApplication
Customize the Symfony Application for Drupal.

Namespace

Drupal\Core\Command

Code

protected function addDrupalCommands(ContainerInterface $container) : void {
  $this->setCommandLoader($container->get('console.command_loader'));
  // Add commands that don't use an attribute, relying solely on configure().
  if ($container->hasParameter('console.command.ids')) {
    foreach ($container->getParameter('console.command.ids') as $id) {
      $this->addCommand($container->get($id));
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.