Skip to content

Commit c75b3c3

Browse files
committed
(feat): Expose getIdAttributeType on Database class
1 parent 6d50ac1 commit c75b3c3

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

src/Database/Database.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,18 @@ public function getNamespace(): string
920920
return $this->adapter->getNamespace();
921921
}
922922

923+
/**
924+
* Get ID Attribute Type.
925+
*
926+
* Returns the type of the internal ID attribute (e.g. VAR_INTEGER for SQL, VAR_UUID7 for MongoDB)
927+
*
928+
* @return string
929+
*/
930+
public function getIdAttributeType(): string
931+
{
932+
return $this->adapter->getIdAttributeType();
933+
}
934+
923935
/**
924936
* Set database to use for current scope
925937
*
@@ -1224,10 +1236,10 @@ public function setSharedTables(bool $sharedTables): static
12241236
*
12251237
* Set tenant to use if tables are shared
12261238
*
1227-
* @param ?int $tenant
1239+
* @param int|string|null $tenant
12281240
* @return static
12291241
*/
1230-
public function setTenant(?int $tenant): static
1242+
public function setTenant(int|string|null $tenant): static
12311243
{
12321244
$this->adapter->setTenant($tenant);
12331245

@@ -1239,9 +1251,9 @@ public function setTenant(?int $tenant): static
12391251
*
12401252
* Get tenant to use if tables are shared
12411253
*
1242-
* @return ?int
1254+
* @return int|string|null
12431255
*/
1244-
public function getTenant(): ?int
1256+
public function getTenant(): int|string|null
12451257
{
12461258
return $this->adapter->getTenant();
12471259
}
@@ -1251,11 +1263,11 @@ public function getTenant(): ?int
12511263
*
12521264
* Execute a callback with a specific tenant
12531265
*
1254-
* @param int|null $tenant
1266+
* @param int|string|null $tenant
12551267
* @param callable $callback
12561268
* @return mixed
12571269
*/
1258-
public function withTenant(?int $tenant, callable $callback): mixed
1270+
public function withTenant(int|string|null $tenant, callable $callback): mixed
12591271
{
12601272
$previous = $this->adapter->getTenant();
12611273
$this->adapter->setTenant($tenant);

0 commit comments

Comments
 (0)