You are here

public static function EntityUsageBatchManager::batchFinished in Entity Usage 8.2

Finish callback for our batch processing.

Parameters

bool $success: Whether the batch completed successfully.

array $results: The results array.

array $operations: The operations array.

File

src/EntityUsageBatchManager.php, line 245

Class

EntityUsageBatchManager
Manages Entity Usage integration with Batch API.

Namespace

Drupal\entity_usage

Code

public static function batchFinished($success, array $results, array $operations) {
  if ($success) {
    \Drupal::messenger()
      ->addMessage(t('Recreated entity usage for @count entities.', [
      '@count' => count($results),
    ]));
  }
  else {

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