From ea28283f030ae69ef3a33659a2bd2356f929cdfe Mon Sep 17 00:00:00 2001 From: Alex Berryman Date: Tue, 12 Jun 2018 14:34:30 -0500 Subject: [PATCH 1/3] OPS-1109 | Use PDOConnection since it implements ServerInfoAwareConnection and allows selection of Mysql57Platform based on server version --- src/PDO/Builder.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PDO/Builder.php b/src/PDO/Builder.php index 5eed0194..5c4d55a1 100644 --- a/src/PDO/Builder.php +++ b/src/PDO/Builder.php @@ -3,6 +3,7 @@ namespace Neighborhoods\Kojo\PDO; +use Doctrine\DBAL\Driver\PDOConnection; use Neighborhoods\Pylon\Data\Property\Defensive; class Builder implements BuilderInterface @@ -26,7 +27,7 @@ public function getPdo(): \PDO }else { $options = []; } - $this->_pdo = new \PDO($dsn, $userName, $password, $options); + $this->_pdo = new PDOConnection($dsn, $userName, $password, $options); } return $this->_pdo; @@ -87,4 +88,4 @@ protected function _hasOptions(): bool { return $this->_exists(self::PROP_OPTIONS); } -} \ No newline at end of file +} From 47f819ff4602dd9535d7717afe597d95e1e8c043 Mon Sep 17 00:00:00 2001 From: Alex Berryman Date: Tue, 12 Jun 2018 16:04:55 -0500 Subject: [PATCH 2/3] OPS-1109 | Revert "OPS-1109 | Use PDOConnection since it implements ServerInfoAwareConnection and allows selection of Mysql57Platform based on server version" This reverts commit ea28283 --- src/PDO/Builder.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/PDO/Builder.php b/src/PDO/Builder.php index 5c4d55a1..5eed0194 100644 --- a/src/PDO/Builder.php +++ b/src/PDO/Builder.php @@ -3,7 +3,6 @@ namespace Neighborhoods\Kojo\PDO; -use Doctrine\DBAL\Driver\PDOConnection; use Neighborhoods\Pylon\Data\Property\Defensive; class Builder implements BuilderInterface @@ -27,7 +26,7 @@ public function getPdo(): \PDO }else { $options = []; } - $this->_pdo = new PDOConnection($dsn, $userName, $password, $options); + $this->_pdo = new \PDO($dsn, $userName, $password, $options); } return $this->_pdo; @@ -88,4 +87,4 @@ protected function _hasOptions(): bool { return $this->_exists(self::PROP_OPTIONS); } -} +} \ No newline at end of file From 693a87b1a2f7fef373e268d092b7bd0e9a301f5c Mon Sep 17 00:00:00 2001 From: Alex Berryman Date: Tue, 12 Jun 2018 16:28:22 -0500 Subject: [PATCH 3/3] OPS-1109 | define a serverVersion so that Doctrine can pick the correct platform --- src/Doctrine/Connection/Decorator.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Doctrine/Connection/Decorator.php b/src/Doctrine/Connection/Decorator.php index a8c249ad..8bb8cff0 100644 --- a/src/Doctrine/Connection/Decorator.php +++ b/src/Doctrine/Connection/Decorator.php @@ -22,10 +22,12 @@ public function getDoctrineConnection(): Connection { if (!$this->_exists(Connection::class)) { if ($this->_hasPDO()) { - $connection = DriverManager::getConnection(['pdo' => $this->_getPDO()]); + $serverVersion = $this->_getPDO()->getAttribute(\PDO::ATTR_SERVER_VERSION); + $connection = DriverManager::getConnection(['pdo' => $this->_getPDO(), 'serverVersion' => $serverVersion]); } else { $pdoBuilder = $this->_getPDOBuilderFactory()->create(); - $connection = DriverManager::getConnection(['pdo' => $pdoBuilder->getPdo()]); + $serverVersion = $pdoBuilder->getPdo()->getAttribute(\PDO::ATTR_SERVER_VERSION); + $connection = DriverManager::getConnection(['pdo' => $pdoBuilder->getPdo(), 'serverVersion' => $serverVersion]); } // $connection->getConfiguration()->setSQLLogger(new EchoSQLLogger()); @@ -69,4 +71,4 @@ public function getId(): string { return $this->_read(self::PROP_ID); } -} \ No newline at end of file +}