From f947fde7013eb25f94e4cc8dec63a867816dcc7a Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 7 May 2026 13:56:46 +0100 Subject: [PATCH] Restore platform fallback and null-template round-trip in BuildMessage - toArray() falls back to Config::getParam('platform') when the in-memory platform is empty, matching the old Build event behavior so workers always receive a populated platform array. - toArray() emits null for an absent template instead of an empty array, and fromArray() treats empty/null/missing template as null so the round-trip preserves the no-template case. Co-Authored-By: Claude Opus 4.7 --- src/Appwrite/Event/Message/Build.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Event/Message/Build.php b/src/Appwrite/Event/Message/Build.php index 7dfc8ea39a..0c8967aff6 100644 --- a/src/Appwrite/Event/Message/Build.php +++ b/src/Appwrite/Event/Message/Build.php @@ -2,6 +2,7 @@ namespace Appwrite\Event\Message; +use Utopia\Config\Config; use Utopia\Database\Document; final class Build extends Base @@ -18,13 +19,15 @@ final class Build extends Base public function toArray(): array { + $platform = !empty($this->platform) ? $this->platform : Config::getParam('platform', []); + return [ 'project' => $this->project->getArrayCopy(), 'resource' => $this->resource->getArrayCopy(), 'deployment' => $this->deployment->getArrayCopy(), 'type' => $this->type, - 'template' => $this->template?->getArrayCopy() ?? [], - 'platform' => $this->platform, + 'template' => $this->template?->getArrayCopy(), + 'platform' => $platform, ]; } @@ -35,7 +38,7 @@ final class Build extends Base resource: new Document($data['resource'] ?? []), deployment: new Document($data['deployment'] ?? []), type: $data['type'] ?? '', - template: isset($data['template']) ? new Document($data['template']) : null, + template: !empty($data['template']) ? new Document($data['template']) : null, platform: $data['platform'] ?? [], ); }