You are here

protected function MigrateUpdater::processEntity in GatherContent 8.5

1 call to MigrateUpdater::processEntity()
MigrateUpdater::processMigration in gathercontent_upload/src/Export/MigrateUpdater.php

File

gathercontent_upload/src/Export/MigrateUpdater.php, line 102

Class

MigrateUpdater
Class for handling import/update logic from GatherContent to Drupal.

Namespace

Drupal\gathercontent_upload\Export

Code

protected function processEntity(MigrationInterface $migration, array $entities, Row $row) {
  $destinationConfiguration = $migration
    ->getDestinationConfiguration();
  $plugin = explode(':', $destinationConfiguration['plugin']);
  $idMap = $migration
    ->getIdMap();

  /** @var \Drupal\Core\Entity\EntityInterface $entity */
  foreach ($entities as $entity) {
    if ($plugin[1] !== $entity
      ->getEntityTypeId()) {
      continue;
    }
    $destinationIds = [
      $entity
        ->id(),
    ];
    if ($entity
      ->getEntityTypeId() === 'paragraph') {
      $destinationIds[] = $entity
        ->getRevisionId();
    }
    $idMap
      ->saveIdMapping($row, $destinationIds);
    $this
      ->processLanguages($migration, $entity, $row, $destinationIds);
  }
}