support mysqli in connection string (#2190)

This commit is contained in:
Kevin Papst
2020-12-13 03:13:04 +01:00
committed by GitHub
parent 26c2d5aa81
commit 64d1aecf16

View File

@@ -22,8 +22,9 @@ class DoctrineCompilerPass implements CompilerPassInterface
* @var string[]
*/
private $allowedEngines = [
'mysql',
'sqlite'
'mysql' => 'mysql',
'mysqli' => 'mysql',
'sqlite' => 'sqlite',
];
private function getEnvVar(string $name): ?string
@@ -72,14 +73,14 @@ class DoctrineCompilerPass implements CompilerPassInterface
);
}
if (!\in_array($engine, $this->allowedEngines)) {
if (!\array_key_exists($engine, $this->allowedEngines)) {
throw new \Exception(
'Unsupported database engine: ' . $engine . '. Kimai only supports one of: ' .
implode(', ', $this->allowedEngines)
implode(', ', array_keys($this->allowedEngines))
);
}
return $engine;
return $this->allowedEngines[$engine];
}
/**