mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Fixed doctrine middlewares
We now look directly onto the driver arguments instead of retrieving a database platform, for which we would need the database version. As we modify driver specific options there, this might be the better choice anyway
This commit is contained in:
parent
43ca543651
commit
777bfed813
3 changed files with 3 additions and 3 deletions
|
@ -42,7 +42,7 @@ class MySQLSSLConnectionMiddlewareDriver extends AbstractDriverMiddleware
|
||||||
public function connect(array $params): Connection
|
public function connect(array $params): Connection
|
||||||
{
|
{
|
||||||
//Only set this on MySQL connections, as other databases don't support this parameter
|
//Only set this on MySQL connections, as other databases don't support this parameter
|
||||||
if($this->enabled && $this->getDatabasePlatform() instanceof AbstractMySQLPlatform) {
|
if($this->enabled && $params['driver'] === 'pdo_mysql') {
|
||||||
$params['driverOptions'][\PDO::MYSQL_ATTR_SSL_CA] = CaBundle::getSystemCaRootBundlePath();
|
$params['driverOptions'][\PDO::MYSQL_ATTR_SSL_CA] = CaBundle::getSystemCaRootBundlePath();
|
||||||
$params['driverOptions'][\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = $this->verify;
|
$params['driverOptions'][\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = $this->verify;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class SQLiteRegexExtensionMiddlewareDriver extends AbstractDriverMiddleware
|
||||||
$connection = parent::connect($params); // TODO: Change the autogenerated stub
|
$connection = parent::connect($params); // TODO: Change the autogenerated stub
|
||||||
|
|
||||||
//Then add the functions if we are on SQLite
|
//Then add the functions if we are on SQLite
|
||||||
if ($this->getDatabasePlatform() instanceof SqlitePlatform) {
|
if ($params['driver'] === 'pdo_sqlite') {
|
||||||
$native_connection = $connection->getNativeConnection();
|
$native_connection = $connection->getNativeConnection();
|
||||||
|
|
||||||
//Ensure that the function really exists on the connection, as it is marked as experimental according to PHP documentation
|
//Ensure that the function really exists on the connection, as it is marked as experimental according to PHP documentation
|
||||||
|
|
|
@ -35,7 +35,7 @@ class SetSQLModeMiddlewareDriver extends AbstractDriverMiddleware
|
||||||
public function connect(array $params): Connection
|
public function connect(array $params): Connection
|
||||||
{
|
{
|
||||||
//Only set this on MySQL connections, as other databases don't support this parameter
|
//Only set this on MySQL connections, as other databases don't support this parameter
|
||||||
if($this->getDatabasePlatform() instanceof AbstractMySQLPlatform) {
|
if($params['driver'] === 'pdo_mysql') {
|
||||||
//1002 is \PDO::MYSQL_ATTR_INIT_COMMAND constant value
|
//1002 is \PDO::MYSQL_ATTR_INIT_COMMAND constant value
|
||||||
$params['driverOptions'][\PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode, \'ONLY_FULL_GROUP_BY\', \'\'))';
|
$params['driverOptions'][\PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode, \'ONLY_FULL_GROUP_BY\', \'\'))';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue