You are here

public static function MigrateUpgradeRunBatch::onIdMapMessage in Migrate Upgrade 8

Displays any messages being logged to the ID map.

Parameters

\Drupal\migrate\Event\MigrateIdMapMessageEvent $event: The message event.

File

src/MigrateUpgradeRunBatch.php, line 357
Contains \Drupal\migrate_upgrade\MigrateUpgradeRunBatch.

Class

MigrateUpgradeRunBatch
Runs a single migration batch.

Namespace

Drupal\migrate_upgrade

Code

public static function onIdMapMessage(MigrateIdMapMessageEvent $event) {
  if ($event
    ->getLevel() == MigrationInterface::MESSAGE_NOTICE || $event
    ->getLevel() == MigrationInterface::MESSAGE_INFORMATIONAL) {
    $type = 'status';
  }
  else {
    $type = 'error';
  }
  $source_id_string = implode(',', $event
    ->getSourceIdValues());
  $message = t('Source ID @source_id: @message', [
    '@source_id' => $source_id_string,
    '@message' => $event
      ->getMessage(),
  ]);
  static::$messages
    ->display($message, $type);
}