From 6deabc665472639d5615e923cc43bb3d9c8aadca Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Sun, 10 May 2026 05:07:41 +0100 Subject: [PATCH] fix: use named arguments for Sites/Functions create + createVariable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SDK 23.1 inserted \$startCommand between \$buildCommand and \$outputDirectory in Sites::create, which silently shifted positional calls — outputDirectory landed in startCommand and adapter landed in outputDirectory, causing testAppwriteMigrationSite to migrate sites with empty adapter. Fixed by switching to named arguments. Apply the same to: - Functions::create - Functions::createVariable - Sites::createVariable Named args are robust against future positional insertions in the generated SDK. --- src/Migration/Destinations/Appwrite.php | 62 ++++++++++++------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/Migration/Destinations/Appwrite.php b/src/Migration/Destinations/Appwrite.php index 29a68634a3..71ab9da828 100644 --- a/src/Migration/Destinations/Appwrite.php +++ b/src/Migration/Destinations/Appwrite.php @@ -2307,18 +2307,18 @@ class Appwrite extends Destination }; $this->functions->create( - $resource->getId(), - $resource->getFunctionName(), - $runtime, - $resource->getExecute(), - $resource->getEvents(), - $resource->getSchedule(), - $resource->getTimeout(), - $resource->getEnabled(), - $resource->getLogging(), - $resource->getEntrypoint(), - $resource->getCommands(), - $resource->getScopes(), + functionId: $resource->getId(), + name: $resource->getFunctionName(), + runtime: $runtime, + execute: $resource->getExecute(), + events: $resource->getEvents(), + schedule: $resource->getSchedule(), + timeout: $resource->getTimeout(), + enabled: $resource->getEnabled(), + logging: $resource->getLogging(), + entrypoint: $resource->getEntrypoint(), + commands: $resource->getCommands(), + scopes: $resource->getScopes(), buildSpecification: $resource->getSpecification() ?: null, runtimeSpecification: $resource->getSpecification() ?: null, ); @@ -2326,10 +2326,10 @@ class Appwrite extends Destination case Resource::TYPE_ENVIRONMENT_VARIABLE: /** @var EnvVar $resource */ $this->functions->createVariable( - $resource->getFunc()->getId(), - $resource->getId(), - $resource->getKey(), - $resource->getValue() + functionId: $resource->getFunc()->getId(), + variableId: $resource->getId(), + key: $resource->getKey(), + value: $resource->getValue(), ); break; case Resource::TYPE_DEPLOYMENT: @@ -2557,17 +2557,17 @@ class Appwrite extends Destination }; $this->sites->create( - $resource->getId(), - $resource->getSiteName(), - $framework, - $buildRuntime, - $resource->getEnabled(), - $resource->getLogging(), - $resource->getTimeout(), - $resource->getInstallCommand(), - $resource->getBuildCommand(), - $resource->getOutputDirectory(), - $adapter, + siteId: $resource->getId(), + name: $resource->getSiteName(), + framework: $framework, + buildRuntime: $buildRuntime, + enabled: $resource->getEnabled(), + logging: $resource->getLogging(), + timeout: $resource->getTimeout(), + installCommand: $resource->getInstallCommand(), + buildCommand: $resource->getBuildCommand(), + outputDirectory: $resource->getOutputDirectory(), + adapter: $adapter, fallbackFile: $resource->getFallbackFile(), buildSpecification: $resource->getSpecification() ?: null, runtimeSpecification: $resource->getSpecification() ?: null, @@ -2576,10 +2576,10 @@ class Appwrite extends Destination case Resource::TYPE_SITE_VARIABLE: /** @var SiteEnvVar $resource */ $this->sites->createVariable( - $resource->getSite()->getId(), - $resource->getId(), - $resource->getKey(), - $resource->getValue() + siteId: $resource->getSite()->getId(), + variableId: $resource->getId(), + key: $resource->getKey(), + value: $resource->getValue(), ); break; case Resource::TYPE_SITE_DEPLOYMENT: