You are here

public function NodeTranslationMigrateSubscriber::onPostRowSave in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/node/src/EventSubscriber/NodeTranslationMigrateSubscriber.php \Drupal\node\EventSubscriber\NodeTranslationMigrateSubscriber::onPostRowSave()
  2. 10 core/modules/node/src/EventSubscriber/NodeTranslationMigrateSubscriber.php \Drupal\node\EventSubscriber\NodeTranslationMigrateSubscriber::onPostRowSave()

Maps the old nid to the new one in the key value collection.

Parameters

\Drupal\migrate\Event\MigratePostRowSaveEvent $event: The migrate post row save event.

File

core/modules/node/src/EventSubscriber/NodeTranslationMigrateSubscriber.php, line 79

Class

NodeTranslationMigrateSubscriber
Creates a key value collection for migrated node translation redirections.

Namespace

Drupal\node\EventSubscriber

Code

public function onPostRowSave(MigratePostRowSaveEvent $event) {
  if ($this
    ->isNodeTranslationsMigration($event)) {
    $row = $event
      ->getRow();
    $source = $row
      ->getSource();
    $destination = $row
      ->getDestination();
    $collection = $this->keyValue
      ->get('node_translation_redirect');
    $collection
      ->set($source['nid'], [
      $destination['nid'],
      $destination['langcode'],
    ]);
  }
}