mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
feat: update worker class
This commit is contained in:
1 parent
3ab4dcb7c1
commit
a0c43f1fe3
2 files changed
+13
-13
No files matched your search
@@ -160,19 +160,20 @@ abstract class Worker
|
||||
*/
|
||||
protected function getProjectDB(string $projectId): Database
|
||||
{
|
||||
global $register;
|
||||
|
||||
if (!$projectId) {
|
||||
throw new \Exception('ProjectID not provided - cannot get database');
|
||||
}
|
||||
|
||||
$namespace = "_{$projectId}";
|
||||
|
||||
global $register;
|
||||
$dbForConsole = $this->getConsoleDB();
|
||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||
$dbName = $project->getAttribute('database', '');
|
||||
|
||||
$projectDB = $register->get('dbPool')->getDB($dbName);
|
||||
|
||||
|
||||
return $this->getDB(self::DATABASE_PROJECT, $projectDB, $namespace);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user