You are here

public static function MigrateUpgradeDrushRunner::onIdMapMessage in Migrate Upgrade 8

Same name and namespace in other branches
  1. 8.3 src/MigrateUpgradeDrushRunner.php \Drupal\migrate_upgrade\MigrateUpgradeDrushRunner::onIdMapMessage()
  2. 8.2 src/MigrateUpgradeDrushRunner.php \Drupal\migrate_upgrade\MigrateUpgradeDrushRunner::onIdMapMessage()

Display any messages being logged to the ID map.

Parameters

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

File

src/MigrateUpgradeDrushRunner.php, line 115
Contains \Drupal\migrate_upgrade\MigrateUpgradeDrushRunner.

Class

MigrateUpgradeDrushRunner

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);
}