You are here

public function MigrateExecutable::onMapSave in Migrate Tools 8.2

Same name and namespace in other branches
  1. 8.5 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onMapSave()
  2. 8 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onMapSave()
  3. 8.3 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onMapSave()
  4. 8.4 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onMapSave()

Count up any map save events.

Parameters

\Drupal\migrate\Event\MigrateMapSaveEvent $event: The map event.

File

src/MigrateExecutable.php, line 120

Class

MigrateExecutable

Namespace

Drupal\migrate_tools

Code

public function onMapSave(MigrateMapSaveEvent $event) {

  // Only count saves for this migration.
  if ($event
    ->getMap()
    ->getQualifiedMapTableName() == $this->migration
    ->getIdMap()
    ->getQualifiedMapTableName()) {
    $fields = $event
      ->getFields();

    // Distinguish between creation and update.
    if ($fields['source_row_status'] == MigrateIdMapInterface::STATUS_IMPORTED && $this->preExistingItem) {
      $this->saveCounters[MigrateIdMapInterface::STATUS_NEEDS_UPDATE]++;
    }
    else {
      $this->saveCounters[$fields['source_row_status']]++;
    }
  }
}