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:
@@ -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