mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
fix: handle SDK 23 nested typed objects (Preferences, Target, MessageStatus)
Five runtime bugs missed in the previous regex pass; PHPStan level 8 caught them when checking against the SDK Models. Migration's resource constructors expect plain arrays / strings, not the nested typed objects SDK 23 returns: - \$user->prefs is Preferences object -> use ->data array - \$user->targets is array<Target> -> array_map(fn(\$t) => \$t->toArray()) - \$team->prefs same Preferences fix - \$function->specification doesn't exist on FunctionModel any more; read runtimeSpecification ?: buildSpecification (SDK 21 split) - \$site->specification same Site fix - \$message->status is MessageStatus enum -> cast to string via __toString PHPStan level 3 (project default) clean. Level 8 has no remaining SDK type issues across Sources/Destinations/Reader.
This commit is contained in:
1 parent
a5195bad3e
commit
80e9a0498e
1 file changed
+6
-6
@@ -619,8 +619,8 @@ class Appwrite extends Source
|
||||
$user->emailVerification ?? false,
|
||||
$user->phoneVerification ?? false,
|
||||
!$user->status,
|
||||
$user->prefs ?? [],
|
||||
$user->targets ?? [],
|
||||
$user->prefs->data ?? [],
|
||||
\array_map(fn ($target) => $target->toArray(), $user->targets ?? []),
|
||||
);
|
||||
|
||||
$lastDocument = $user->id;
|
||||
@@ -665,7 +665,7 @@ class Appwrite extends Source
|
||||
$teams[] = new Team(
|
||||
$team->id,
|
||||
$team->name,
|
||||
$team->prefs,
|
||||
$team->prefs->data,
|
||||
);
|
||||
|
||||
$lastDocument = $team->id;
|
||||
@@ -1485,7 +1485,7 @@ class Appwrite extends Source
|
||||
$function->commands ?? '',
|
||||
$function->logging ?? true,
|
||||
$function->scopes ?? [],
|
||||
$function->specification ?? '',
|
||||
$function->runtimeSpecification ?: $function->buildSpecification ?: '',
|
||||
);
|
||||
$functions[] = $convertedFunc;
|
||||
|
||||
@@ -1972,7 +1972,7 @@ class Appwrite extends Source
|
||||
$message->users ?? [],
|
||||
$message->targets ?? [],
|
||||
$message->data ?? [],
|
||||
$message->status ?? '',
|
||||
(string) $message->status,
|
||||
$message->scheduledAt ?? '',
|
||||
$message->deliveredAt ?? '',
|
||||
$message->deliveryErrors ?? [],
|
||||
@@ -2036,7 +2036,7 @@ class Appwrite extends Source
|
||||
$site->outputDirectory ?? '',
|
||||
$site->adapter ?? 'static',
|
||||
$site->fallbackFile ?? '',
|
||||
$site->specification ?? '',
|
||||
$site->runtimeSpecification ?: $site->buildSpecification ?: '',
|
||||
$site->deploymentId ?? ''
|
||||
);
|
||||
$sites[] = $convertedSite;
|
||||
|
||||
Reference in new issue
Block a user