Skip to content

Commit 8e6a033

Browse files
authored
Merge pull request #786 from utopia-php/feat-no-use-init
2 parents 7b935bb + 82b2af7 commit 8e6a033

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

src/Database/Adapter/Pool.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,10 @@ class Pool extends Adapter
1818

1919
/**
2020
* @param UtopiaPool<covariant Adapter> $pool The pool to use for connections. Must contain instances of Adapter.
21-
* @throws DatabaseException
2221
*/
2322
public function __construct(UtopiaPool $pool)
2423
{
2524
$this->pool = $pool;
26-
27-
$this->pool->use(function (mixed $resource) {
28-
if (!($resource instanceof Adapter)) {
29-
throw new DatabaseException('Pool must contain instances of ' . Adapter::class);
30-
}
31-
32-
// Run setters in case the pooled adapter has its own config
33-
try {
34-
$this->setAuthorization($resource->getAuthorization());
35-
} catch (\Error $e) {
36-
// Authorization not initialized yet, so skip it.
37-
}
38-
$this->setDatabase($resource->getDatabase());
39-
$this->setNamespace($resource->getNamespace());
40-
$this->setSharedTables($resource->getSharedTables());
41-
$this->setTenant($resource->getTenant());
42-
43-
if ($resource->getTimeout() > 0) {
44-
$this->setTimeout($resource->getTimeout());
45-
}
46-
$this->resetDebug();
47-
foreach ($resource->getDebug() as $key => $value) {
48-
$this->setDebug($key, $value);
49-
}
50-
$this->resetMetadata();
51-
foreach ($resource->getMetadata() as $key => $value) {
52-
$this->setMetadata($key, $value);
53-
}
54-
});
5525
}
5626

5727
/**

0 commit comments

Comments
 (0)