Skip to content

Commit b031a9d

Browse files
authored
Symfony bundle - Handle driver configuration with Reference class (#312)
As `Nextras\Dbal\Connection->createDriver()` does support driver as instance, I have added this into Symfony bundle config.
1 parent a89576c commit b031a9d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Bridges/SymfonyBundle/DependencyInjection/NextrasDbalExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ private function loadConnection(
5959
ContainerInterface::NULL_ON_INVALID_REFERENCE,
6060
);
6161

62+
if (isset($config['driver']) && is_string($config['driver']) && str_starts_with($config['driver'], '@')) {
63+
$config['driver'] = new Reference(ltrim($config['driver'], '@'));
64+
}
65+
6266
$connectionDefinition = new Definition(Connection::class);
6367
$connectionDefinition->setArgument('$config', $config);
6468
$connectionDefinition->setPublic(true);

0 commit comments

Comments
 (0)