Skip to content

Commit 68efead

Browse files
author
Christian Bohollo
committed
add-laravel11-comp
1 parent 288fe9e commit 68efead

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "",
44
"minimum-stability":"dev",
55
"require": {
6-
"omatech/editora-dbinterface": "^1.3"
6+
"omatech/editora-dbinterface": "^1.4"
77
},
88
"require-dev": {
99
},

src/Omatech/Editora/Connector/ConnectorServiceProvider.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,26 @@ public function boot()
5858
include __DIR__.'/Directives/GenerateEditoraEditScriptsDirective.php';
5959
}
6060

61+
private function toDoctrineDB($config)
62+
{
63+
$driverSchemeAliases = [
64+
'mysql' => 'pdo_mysql',
65+
'mariadb' => 'pdo_mysql',
66+
'postgres' => 'pdo_pgsql',
67+
'sqlite' => 'pdo_sqlite',
68+
'sqlsrv' => 'pdo_sqlsrv',
69+
];
70+
71+
$config['driver'] = $driverSchemeAliases[$config['driver']] ?? $config['driver'];
72+
$config['user'] = $config['username'];
73+
$config['dbname'] = $config['database'];
74+
$config['driverOptions'] = $config['options'] ?? [];
75+
if($config['unix_socket'] ?? false) {
76+
unset($config['host']);
77+
}
78+
return $config;
79+
}
80+
6181
/**
6282
* Register the application services.
6383
*
@@ -70,7 +90,9 @@ public function register()
7090
'editora'
7191
);
7292

73-
$db=DB::connection()->getDoctrineConnection();
93+
$db = DB::connection()->getConfig();
94+
$db = $this->toDoctrineDB($db);
95+
7496
$this->app->bind('Extractor', function () use ($db) {
7597
return new Extractor($db);
7698
});

0 commit comments

Comments
 (0)