From 5764ea9ade2691302ce2cee4340f74fff3cd3f98 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 29 May 2024 19:09:14 +0300 Subject: [PATCH] static getCollectionId --- src/Appwrite/Platform/Tasks/ScheduleBase.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index af7fe9d221..e06873e825 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -59,14 +59,8 @@ abstract class ScheduleBase extends Action $getSchedule = function (Document $schedule) use ($dbForConsole, $getProjectDB): array { $project = $dbForConsole->getDocument('projects', $schedule->getAttribute('projectId')); - $collectionId = match ($schedule->getAttribute('resourceType')) { - 'function' => 'functions', - 'message' => 'messages', - 'backup' => 'backupsPolicy' - }; - $resource = $getProjectDB($project)->getDocument( - $collectionId, + static::getCollectionId(), $schedule->getAttribute('resourceId') ); @@ -112,12 +106,7 @@ abstract class ScheduleBase extends Action var_dump('=== ScheduleBase end'); $this->schedules[$document['resourceId']] = $getSchedule($document); } catch (\Throwable $th) { - $collectionId = match ($document->getAttribute('resourceType')) { - 'function' => 'functions', - 'message' => 'messages', - 'backup' => 'backupsPolicy' - }; - + $collectionId = static::getCollectionId(); Console::error("Failed to load schedule for project {$document['projectId']} {$collectionId} {$document['resourceId']}"); Console::error($th->getMessage()); }