You are here

public function Updater::dispatchUpdateEvent in Automatic Updates 8.2

Dispatches an update event.

Parameters

\Drupal\automatic_updates\Event\UpdateEvent $event: The update event.

string $event_name: The name of the event to dispatch.

Return value

\Drupal\automatic_updates\Event\UpdateEvent The event object.

Throws

\Drupal\automatic_updates\Exception\UpdateException If any of the event subscribers adds a validation error.

2 calls to Updater::dispatchUpdateEvent()
Updater::begin in src/Updater.php
Begins the update.
Updater::commit in src/Updater.php
Commits the current update.

File

src/Updater.php, line 273

Class

Updater
Defines a service to perform updates.

Namespace

Drupal\automatic_updates

Code

public function dispatchUpdateEvent(UpdateEvent $event, string $event_name) : UpdateEvent {
  $this->eventDispatcher
    ->dispatch($event, $event_name);
  if ($checker_results = $event
    ->getResults(SystemManager::REQUIREMENT_ERROR)) {
    throw new UpdateException($checker_results, "Unable to complete the update because of errors.");
  }
  return $event;
}