protected function SqlBase::setUpDatabase in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/src/Plugin/migrate/source/SqlBase.php \Drupal\migrate\Plugin\migrate\source\SqlBase::setUpDatabase()
Get a connection to the referenced database, adding the connection if necessary.
Parameters
array $database_info: Configuration for the source database connection. The keys are: 'key' - The database connection key. 'target' - The database connection target. 'database' - Database configuration array as accepted by Database::addConnectionInfo.
Return value
\Drupal\Core\Database\Connection The connection to use for this plugin's queries.
1 call to SqlBase::setUpDatabase()
- SqlBase::getDatabase in core/
modules/ migrate/ src/ Plugin/ migrate/ source/ SqlBase.php - Get the database connection object.
File
- core/
modules/ migrate/ src/ Plugin/ migrate/ source/ SqlBase.php, line 111 - Contains \Drupal\migrate\Plugin\migrate\source\SqlBase.
Class
- SqlBase
- Sources whose data may be fetched via DBTNG.
Namespace
Drupal\migrate\Plugin\migrate\sourceCode
protected function setUpDatabase(array $database_info) {
if (isset($database_info['key'])) {
$key = $database_info['key'];
}
else {
$key = 'migrate';
}
if (isset($database_info['target'])) {
$target = $database_info['target'];
}
else {
$target = 'default';
}
if (isset($database_info['database'])) {
Database::addConnectionInfo($key, $target, $database_info['database']);
}
return Database::getConnection($target, $key);
}