auditMultiple example

// If data is missing or this is the wrong step, start over.     if (!$migrations || ($this->store->get('step') != 'idconflict')) {
      return $this->restartUpgradeForm();
    }

    $migration_ids = array_keys($migrations);
    // Check if there are conflicts. If none, just skip this form!     $migrations = $this->migrationPluginManager->createInstances($migration_ids);

    $translated_content_conflicts = $content_conflicts = [];

    $results = (new IdAuditor())->auditMultiple($migrations);

    /** @var \Drupal\migrate\Audit\AuditResult $result */
    foreach ($results as $result) {
      $destination = $result->getMigration()->getDestinationPlugin();
      if ($destination instanceof EntityContentBase && $destination->isTranslationDestination()) {
        // Translations are not yet supported by the audit system. For now, we         // only warn the user to be cautious when migrating translated content.         // I18n support should be added in https://www.drupal.org/node/2905759.         $translated_content_conflicts[] = $result;
      }
      elseif (!$result->passed()) {
        
->execute();

    // Audit the IDs of the d6_node migrations for the page & article node type.     // There should be no conflicts since the highest destination ID should be     // equal to the highest migrated ID, as found in the aggregated mapping     // tables of the two node migrations.     $migrations = [
      $this->getMigration('d6_node:page'),
      $this->getMigration('d6_node:article'),
    ];

    $results = (new IdAuditor())->auditMultiple($migrations);
    /** @var \Drupal\migrate\Audit\AuditResult $result */
    foreach ($results as $result) {
      $this->assertInstanceOf(AuditResult::class$result);
      $this->assertTrue($result->passed());
    }
  }

  /** * Tests all migrations with no ID conflicts. */
  public function testAllMigrationsWithNoIdConflicts() {
    
->execute();

    // Audit the IDs of the d7_node migrations for the page & article node type.     // There should be no conflicts since the highest destination ID should be     // equal to the highest migrated ID, as found in the aggregated mapping     // tables of the two node migrations.     $migrations = [
      $this->getMigration('d7_node:page'),
      $this->getMigration('d7_node:article'),
    ];

    $results = (new IdAuditor())->auditMultiple($migrations);
    /** @var \Drupal\migrate\Audit\AuditResult $result */
    foreach ($results as $result) {
      $this->assertInstanceOf(AuditResult::class$result);
      $this->assertTrue($result->passed());
    }
  }

  /** * Tests all migrations with no ID conflicts. */
  public function testAllMigrationsWithNoIdConflicts() {
    
Home | Imprint | This part of the site doesn't use cookies.