Skip to content

Commit

Permalink
Fix Docrtine DBAL deprecation notice, initialize Config and set Defau…
Browse files Browse the repository at this point in the history
…ltSchemaManagerFactory
  • Loading branch information
Composite PHP committed Nov 3, 2024
1 parent 0945254 commit a869f6b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ConnectionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;

class ConnectionManager
{
Expand All @@ -24,6 +25,12 @@ public static function getConnection(string $name, ?Configuration $config = null
{
if (!isset(self::$connections[$name])) {
try {
if (!$config) {
$config = new Configuration();
}
if (!$config->getSchemaManagerFactory()) {
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
}
self::$connections[$name] = DriverManager::getConnection(
params: self::getConnectionParams($name),
config: $config,
Expand Down

0 comments on commit a869f6b

Please sign in to comment.