function MigrationConfigurationTrait::getConnection

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

Gets the database connection for the source Drupal database.

Parameters

array $database: Database array representing the source Drupal database.

Return value

\Drupal\Core\Database\Connection The database connection for the source Drupal database.

1 call to MigrationConfigurationTrait::getConnection()
CredentialForm::validateForm in core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
Form validation handler.

File

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

Class

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

Namespace

Drupal\migrate_drupal

Code

protected function getConnection(array $database) {
    // Set up the connection.
    Database::addConnectionInfo('upgrade', 'default', $database);
    $connection = Database::getConnection('default', 'upgrade');
    return $connection;
}

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