feat: update worker class

This commit is contained in:
Christy Jacob
2022-07-02 10:54:19 +02:00
parent 3ab4dcb7c1
commit a0c43f1fe3
2 changed files with 13 additions and 13 deletions
+3 -2
View File
@@ -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);
}