You are here

public function BatchService::processEntityTypeReindexFinished in Taxonomy Entity Index 8

Batch Finished callback.

Parameters

bool $success: Success of the operation.

array $results: Array of results for post processing.

array $operations: Array of operations.

File

src/BatchService.php, line 45

Class

BatchService
Class BatchService.

Namespace

Drupal\taxonomy_entity_index

Code

public function processEntityTypeReindexFinished($success, array $results, array $operations) {
  $messenger = \Drupal::messenger();
  if ($success) {

    // Here we could do something meaningful with the results.
    // We just display the number of nodes we processed...
    $messenger
      ->addMessage(t('@count results processed.', [
      '@count' => count($results),
    ]));
  }
  else {

    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    $messenger
      ->addMessage(t('An error occurred while processing @operation with arguments : @args', [
      '@operation' => $error_operation[0],
      '@args' => print_r($error_operation[0], TRUE),
    ]));
  }
}