From 57ca5d8bec05b4e0cecc708a5f4ebe7184e29db7 Mon Sep 17 00:00:00 2001 From: Myke Meynell <1590190+mykemeynell@users.noreply.github.com> Date: Sun, 4 May 2025 12:49:01 +0100 Subject: [PATCH 1/4] Update DatabaseCluster.php Fixed issue with null being assigned to typed properties when DO returns cluster with status `creating`. --- src/Entity/DatabaseCluster.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Entity/DatabaseCluster.php b/src/Entity/DatabaseCluster.php index 25ea002..c093f5a 100644 --- a/src/Entity/DatabaseCluster.php +++ b/src/Entity/DatabaseCluster.php @@ -72,9 +72,11 @@ public function build(array $parameters): void } elseif ('privateConnection' === $property) { $this->privateConnection = new DatabaseConnection($value); } elseif ('users' === $property) { - $this->users = \array_map(fn ($v) => new DatabaseUser($v), $value); + $this->users = \array_map(fn ($v) => new DatabaseUser($v), $value ?? []); } elseif ('maintenanceWindow' === $property) { $this->maintenanceWindow = new DatabaseMaintenanceWindow($value); + } elseif('dbNames' === $property) { + $this->dbNames = $value ?? []; } elseif (\property_exists($this, $property)) { $this->$property = $value; } From 197ecc7ac858206547935453d8682ad2934f03b5 Mon Sep 17 00:00:00 2001 From: Myke Meynell <1590190+mykemeynell@users.noreply.github.com> Date: Sun, 4 May 2025 12:51:44 +0100 Subject: [PATCH 2/4] Update DatabaseCluster.php Style changes. --- src/Entity/DatabaseCluster.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Entity/DatabaseCluster.php b/src/Entity/DatabaseCluster.php index c093f5a..f834ca5 100644 --- a/src/Entity/DatabaseCluster.php +++ b/src/Entity/DatabaseCluster.php @@ -75,7 +75,7 @@ public function build(array $parameters): void $this->users = \array_map(fn ($v) => new DatabaseUser($v), $value ?? []); } elseif ('maintenanceWindow' === $property) { $this->maintenanceWindow = new DatabaseMaintenanceWindow($value); - } elseif('dbNames' === $property) { + } elseif ('dbNames' === $property) { $this->dbNames = $value ?? []; } elseif (\property_exists($this, $property)) { $this->$property = $value; From 4947171597ccc62b753a952305f23fefff283bac Mon Sep 17 00:00:00 2001 From: Myke Meynell <1590190+mykemeynell@users.noreply.github.com> Date: Sun, 4 May 2025 21:29:49 +0100 Subject: [PATCH 3/4] Update Droplet.php Allow null VPC as returned from DO when creating a new droplet. --- src/Entity/Droplet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Entity/Droplet.php b/src/Entity/Droplet.php index 423b064..4150fb2 100644 --- a/src/Entity/Droplet.php +++ b/src/Entity/Droplet.php @@ -86,7 +86,7 @@ final class Droplet extends AbstractEntity public NextBackupWindow $nextBackupWindow; - public string $vpcUuid; + public ?string $vpcUuid = null; public function build(array $parameters): void { From 24ae4a751a5805adb2d30d3a1ea859a983dfaa0f Mon Sep 17 00:00:00 2001 From: Myke Meynell <1590190+mykemeynell@users.noreply.github.com> Date: Sun, 4 May 2025 21:37:07 +0100 Subject: [PATCH 4/4] Update DatabaseCluster.php Nullable array type on dbName as returned from DigitalOcean API on database cluster creation. --- src/Entity/DatabaseCluster.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Entity/DatabaseCluster.php b/src/Entity/DatabaseCluster.php index f834ca5..2c8a256 100644 --- a/src/Entity/DatabaseCluster.php +++ b/src/Entity/DatabaseCluster.php @@ -39,7 +39,7 @@ final class DatabaseCluster extends AbstractEntity /** * @var string[] */ - public array $dbNames = []; + public ?array $dbNames = []; public int $numNodes; @@ -75,8 +75,6 @@ public function build(array $parameters): void $this->users = \array_map(fn ($v) => new DatabaseUser($v), $value ?? []); } elseif ('maintenanceWindow' === $property) { $this->maintenanceWindow = new DatabaseMaintenanceWindow($value); - } elseif ('dbNames' === $property) { - $this->dbNames = $value ?? []; } elseif (\property_exists($this, $property)) { $this->$property = $value; }