function MigrationConfigurationTrait::createDatabaseStateSettings

Same name in other branches
  1. 9 core/modules/migrate_drupal/src/MigrationConfigurationTrait.php \Drupal\migrate_drupal\MigrationConfigurationTrait::createDatabaseStateSettings()
  2. 8.9.x core/modules/migrate_drupal/src/MigrationConfigurationTrait.php \Drupal\migrate_drupal\MigrationConfigurationTrait::createDatabaseStateSettings()
  3. 10 core/modules/migrate_drupal/src/MigrationConfigurationTrait.php \Drupal\migrate_drupal\MigrationConfigurationTrait::createDatabaseStateSettings()

Creates the necessary state entries for SqlBase::getDatabase() to work.

The state entities created here have to exist before migration plugin instances are created so that derivers such as \Drupal\taxonomy\Plugin\migrate\D6TermNodeDeriver can access the source database.

Parameters

array $database: The source database settings.

string $drupal_version: The Drupal version.

See also

\Drupal\migrate\Plugin\migrate\source\SqlBase::getDatabase()

1 call to MigrationConfigurationTrait::createDatabaseStateSettings()
CredentialForm::setupMigrations in core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
Gets and stores information for this migration in temporary store.

File

core/modules/migrate_drupal/src/MigrationConfigurationTrait.php, line 102

Class

MigrationConfigurationTrait
Configures the appropriate migrations for a given source Drupal database.

Namespace

Drupal\migrate_drupal

Code

protected function createDatabaseStateSettings(array $database, $drupal_version) {
    $database_state['key'] = 'upgrade';
    $database_state['database'] = $database;
    $database_state_key = 'migrate_drupal_' . $drupal_version;
    $state = $this->getState();
    $state->set($database_state_key, $database_state);
    $state->set('migrate.fallback_state_key', $database_state_key);
}

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