-
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Labels
Description
Describe the bug
Sending driver as reference doesn't work in Symfony Bundle configuration. Nextras receives driver as plain string, does not transform it into object from container.
nextras_dbal:
connections:
name: example
driver: '@App\AcmeDriver'
When I check Nextras\Dbal\Connection method, this class allows usage of IDriver instance:
private function createDriver(): IDriver
{
if (!isset($this->config['driver'])) {
throw new InvalidArgumentException('Undefined driver. Choose from: mysqli, pgsql, sqlsrv, pdo_mysql, pdo_pgsql.');
} elseif ($this->config['driver'] instanceof IDriver) {
return $this->config['driver'];
} else {
$driver = $this->config['driver'];
$name = ucfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', (string) $driver))));
/** @var class-string<IDriver> $class */
$class = "Nextras\\Dbal\\Drivers\\{$name}\\{$name}Driver";
return new $class();
}
}
Versions::
- symfony/*: 7.3
- nextras/dbal: 5.0.4