diff --git a/src/Database/Adapter.php b/src/Database/Adapter.php index a0c1c238a..a7b385cce 100644 --- a/src/Database/Adapter.php +++ b/src/Database/Adapter.php @@ -1581,4 +1581,9 @@ abstract public function getSupportForTransactionRetries(): bool; * @return bool */ abstract public function getSupportForNestedTransactions(): bool; + + /** + * @return mixed + */ + abstract public function getDriver(): mixed; } diff --git a/src/Database/Adapter/Mongo.php b/src/Database/Adapter/Mongo.php index b462d1c28..7ddde43d3 100644 --- a/src/Database/Adapter/Mongo.php +++ b/src/Database/Adapter/Mongo.php @@ -77,6 +77,15 @@ public function __construct(Client $client) $this->client->connect(); } + /** + * Returns the current Mongo client + * @return mixed + */ + public function getDriver(): mixed + { + return $this->client; + } + public function setTimeout(int $milliseconds, string $event = Database::EVENT_ALL): void { if (!$this->getSupportForTimeouts()) { diff --git a/src/Database/Adapter/Pool.php b/src/Database/Adapter/Pool.php index e89be89ac..668753387 100644 --- a/src/Database/Adapter/Pool.php +++ b/src/Database/Adapter/Pool.php @@ -70,6 +70,11 @@ public function delegate(string $method, array $args): mixed }); } + public function getDriver(): mixed + { + return $this->delegate(__FUNCTION__, \func_get_args()); + } + public function before(string $event, string $name = '', ?callable $callback = null): static { $this->delegate(__FUNCTION__, \func_get_args()); diff --git a/src/Database/Adapter/SQL.php b/src/Database/Adapter/SQL.php index 8f0bd2db2..6864e6aee 100644 --- a/src/Database/Adapter/SQL.php +++ b/src/Database/Adapter/SQL.php @@ -2179,12 +2179,22 @@ protected function applyOperatorToValue(Operator $operator, mixed $value): mixed /** * Returns the current PDO object * @return mixed + * @deprecated Use getDriver() instead */ protected function getPDO(): mixed { return $this->pdo; } + /** + * Returns the current PDO object + * @return mixed + */ + public function getDriver(): mixed + { + return $this->pdo; + } + /** * Get PDO Type *