Skip to content

Commit

Permalink
Merge pull request #32 from RamyHakam/25-deprecated-the-url-connectio…
Browse files Browse the repository at this point in the history
…n-parameter-dbal-36

25-deprecated-the-url-connection-parameter-dbal-36
  • Loading branch information
RamyHakam authored Apr 24, 2024
2 parents cd4bb27 + e266d5c commit 466e821
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Services/DbService.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Tools\DsnParser;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Tools\SchemaTool;
use Hakam\MultiTenancyBundle\Doctrine\ORM\TenantEntityManager;
Expand Down Expand Up @@ -41,12 +42,9 @@ public function __construct(
*/
public function createDatabase(string $dbName): int
{
$params = [
"url" => $this->dbCredentials['db_url'],
];

// Override the dbname without preferred dbname
$tmpConnection = DriverManager::getConnection($params);
$dsnParser = new DsnParser(['mysql' => 'pdo_mysql']);
$tmpConnection = DriverManager::getConnection($dsnParser->parse($this->dbCredentials['db_url']));

$platform = $tmpConnection->getDatabasePlatform();
if ($tmpConnection->getDriver() instanceof AbstractMySQLDriver || $tmpConnection->getDriver() instanceof AbstractPostgreSQLDriver) {
Expand Down

0 comments on commit 466e821

Please sign in to comment.