Use DBAL Driver middleware to handle the correct connection timezone
I looked into using DBAL events for this but found that DBAL events are deprecated so I went with middleware as they are recommended as a replacement for the DBAL events. [MAILPOET-6142]
This commit is contained in:
committed by
Aschepikov
parent
3ea44e45d4
commit
9f32c59e49
14
mailpoet/lib/Doctrine/Middlewares/PostConnectMiddleware.php
Normal file
14
mailpoet/lib/Doctrine/Middlewares/PostConnectMiddleware.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace MailPoet\Doctrine\Middlewares;
|
||||
|
||||
use MailPoetVendor\Doctrine\DBAL\Driver\Connection;
|
||||
use MailPoetVendor\Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
|
||||
|
||||
class PostConnectMiddleware extends AbstractDriverMiddleware {
|
||||
public function connect(array $params): Connection {
|
||||
$connection = parent::connect($params);
|
||||
$connection->exec('SET time_zone = "+00:00"');
|
||||
return $connection;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user