$drivers =
$this->
getDatabaseTypes();
$reflection =
new \
ReflectionClass($drivers[$driver]);
$install_namespace =
$reflection->
getNamespaceName();
$database =
$form_state->
getValue($driver);
// Cut the trailing \Install from namespace.
$database['namespace'
] =
substr($install_namespace, 0,
strrpos($install_namespace, '\\'
));
$database['driver'
] =
$driver;
// Validate the driver settings and just end here if we have any issues.
$connection = NULL;
if ($errors =
$drivers[$driver]->
validateDatabaseSettings($database)) { foreach ($errors as $name =>
$message) { $this->errors
[$name] =
$message;
} } } // Get the Drupal version of the source database so it can be validated.
$error_key =
$database['driver'
] . '][database';
if (!
$this->errors
) { try { $connection =
$this->
getConnection($database);
}