lookupSourceID example

/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
    $migration = $this->container
      ->get('plugin.manager.migration')
      ->createStubMigration($migration);

    $this->executeMigration($migration);

    // The entity_revision destination uses the revision ID and langcode as its     // keys (the langcode is only used if the destination is configured for     // translation), so we should be able to look up the source IDs by revision     // ID and langcode.     $source_ids = $migration->getIdMap()->lookupSourceID([
      'vid' => $node->getRevisionId(),
      'langcode' => 'fr',
    ]);
    $this->assertNotEmpty($source_ids);
    $this->assertSame($node->id()$source_ids['nid']);
    $this->assertSame($node->getRevisionId()$source_ids['vid']);
    $this->assertSame('fr', $source_ids['langcode']);

    // Confirm the french revision was used in the migration, instead of the     // default revision.     /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
    
Home | Imprint | This part of the site doesn't use cookies.