You are here

protected function DrupalMigrateForm::connection in Drupal-to-Drupal data migration 8.3

Gets the database connection for the source Drupal database.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: Form state containing the database connection info.

Return value

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

1 call to DrupalMigrateForm::connection()
UserForm::buildForm in migrate_d2d_ui/src/Form/UserForm.php
Form constructor.

File

migrate_d2d_ui/src/Form/DrupalMigrateForm.php, line 30

Class

DrupalMigrateForm
Base class for all steps.

Namespace

Drupal\migrate_d2d_ui\Form

Code

protected function connection(FormStateInterface $form_state) {
  if (!isset($this->sourceConnection)) {
    $cached_values = $form_state
      ->getTemporaryValue('wizard');

    // Set up the connection.
    Database::addConnectionInfo('drupal_import', 'default', $cached_values['database']);
    $this->sourceConnection = Database::getConnection('default', 'drupal_import');
  }
  return $this->sourceConnection;
}