Skip to content

Commit ad89dab

Browse files
Merge remote-tracking branch 'origin/main' into big-init
2 parents b87cf3a + 72ee161 commit ad89dab

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

src/Database/Adapter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,4 +1588,9 @@ abstract public function getSupportForTransactionRetries(): bool;
15881588
* @return bool
15891589
*/
15901590
abstract public function getSupportForNestedTransactions(): bool;
1591+
1592+
/**
1593+
* @return mixed
1594+
*/
1595+
abstract public function getDriver(): mixed;
15911596
}

src/Database/Adapter/Mongo.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ public function __construct(Client $client)
7777
$this->client->connect();
7878
}
7979

80+
/**
81+
* Returns the current Mongo client
82+
* @return mixed
83+
*/
84+
public function getDriver(): mixed
85+
{
86+
return $this->client;
87+
}
88+
8089
public function setTimeout(int $milliseconds, string $event = Database::EVENT_ALL): void
8190
{
8291
if (!$this->getSupportForTimeouts()) {
@@ -2916,7 +2925,7 @@ protected function getQueryValue(string $method, mixed $value): mixed
29162925
*/
29172926
protected function getOrder(string $order): int
29182927
{
2919-
return match ($order) {
2928+
return match (\strtoupper($order)) {
29202929
Database::ORDER_ASC => 1,
29212930
Database::ORDER_DESC => -1,
29222931
default => throw new DatabaseException('Unknown sort order:' . $order . '. Must be one of ' . Database::ORDER_ASC . ', ' . Database::ORDER_DESC),

src/Database/Adapter/Pool.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ public function delegate(string $method, array $args): mixed
7070
});
7171
}
7272

73+
public function getDriver(): mixed
74+
{
75+
return $this->delegate(__FUNCTION__, \func_get_args());
76+
}
77+
7378
public function before(string $event, string $name = '', ?callable $callback = null): static
7479
{
7580
$this->delegate(__FUNCTION__, \func_get_args());

src/Database/Adapter/SQL.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,12 +2193,22 @@ protected function applyOperatorToValue(Operator $operator, mixed $value): mixed
21932193
/**
21942194
* Returns the current PDO object
21952195
* @return mixed
2196+
* @deprecated Use getDriver() instead
21962197
*/
21972198
protected function getPDO(): mixed
21982199
{
21992200
return $this->pdo;
22002201
}
22012202

2203+
/**
2204+
* Returns the current PDO object
2205+
* @return mixed
2206+
*/
2207+
public function getDriver(): mixed
2208+
{
2209+
return $this->pdo;
2210+
}
2211+
22022212
/**
22032213
* Get PDO Type
22042214
*

0 commit comments

Comments
 (0)