You are here

public function CommandSubscriber::onExecute in Update helper 8

Same name and namespace in other branches
  1. 2.x src/Events/CommandSubscriber.php \Drupal\update_helper\Events\CommandSubscriber::onExecute()

Handles execute for configuration update generation to create update hook.

Parameters

\Drupal\update_helper\Events\CommandExecuteEvent $execute_event: Command execute event.

File

src/Events/CommandSubscriber.php, line 47

Class

CommandSubscriber
Subscriber for "generate:configuration:update" command.

Namespace

Drupal\update_helper\Events

Code

public function onExecute(CommandExecuteEvent $execute_event) {

  // If command that triggered this event wasn't successful, then nothing
  // should be created.
  if (!$execute_event
    ->getSuccessful()) {
    return;
  }

  // Get options provided by command as options or in interactive mode.
  $options = $execute_event
    ->getOptions();

  // Generate update hook entry.
  $this->generator
    ->generate($execute_event
    ->getModule(), $execute_event
    ->getUpdateNumber(), $options['description']);
}