Skip to content

Commit 22123ad

Browse files
committed
Refactor getAuthorization method formatting and add error handling for authorization initialization in Pool adapter
1 parent 0a4d6f3 commit 22123ad

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Database/Adapter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ public function setAuthorization(Authorization $authorization): self
6666
}
6767

6868
public function getAuthorization(): Authorization
69-
{
70-
return $this->authorization;
71-
}
69+
{
70+
return $this->authorization;
71+
}
7272
/**
7373
* @param string $key
7474
* @param mixed $value

src/Database/Adapter/Pool.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ public function __construct(UtopiaPool $pool)
3030
}
3131

3232
// Run setters in case the pooled adapter has its own config
33-
$this->setAuthorization($resource->getAuthorization());
33+
try {
34+
$this->setAuthorization($resource->getAuthorization());
35+
} catch (\Error $e) {
36+
// Authorization not initialized yet, so skip it.
37+
}
3438
$this->setDatabase($resource->getDatabase());
3539
$this->setNamespace($resource->getNamespace());
3640
$this->setSharedTables($resource->getSharedTables());

0 commit comments

Comments
 (0)