function NodeTranslationMigrateSubscriber::onPostRowSave

Same name in other branches
  1. 9 core/modules/node/src/EventSubscriber/NodeTranslationMigrateSubscriber.php \Drupal\node\EventSubscriber\NodeTranslationMigrateSubscriber::onPostRowSave()
  2. 8.9.x core/modules/node/src/EventSubscriber/NodeTranslationMigrateSubscriber.php \Drupal\node\EventSubscriber\NodeTranslationMigrateSubscriber::onPostRowSave()
  3. 11.x 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 mappings.

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'],
        ]);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.