Skip to content

Commit

Permalink
Merge pull request #398 from jackalope/native-connection
Browse files Browse the repository at this point in the history
fix access to native connection
  • Loading branch information
dbu authored Apr 29, 2022
2 parents f3107ac + 53fb540 commit 2c54992
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

1.7.6
-----

* Fix to correctly handle SQLite connections when middleware is used by dbal.

1.7.5
-----

Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,10 @@
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true
}
}
}
10 changes: 7 additions & 3 deletions src/Jackalope/Transport/DoctrineDBAL/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -2869,9 +2869,13 @@ private function initConnection()

// @TODO: move to "SqlitePlatform" and rename to "registerExtraFunctions"?
if ($this->conn->getDatabasePlatform() instanceof SqlitePlatform) {
$connection = $this->conn->getWrappedConnection();
if ($connection instanceof PDOConnection && ! $connection instanceof PDO) {
$connection = $connection->getWrappedConnection();
if (method_exists($this->conn, 'getNativeConnection')) {
$connection = $this->conn->getNativeConnection();
} else {
$connection = $this->conn->getWrappedConnection();
if ($connection instanceof PDOConnection && !$connection instanceof PDO) {
$connection = $connection->getWrappedConnection();
}
}

$this->registerSqliteFunctions($connection);
Expand Down

0 comments on commit 2c54992

Please sign in to comment.