From 1a43bafbae3978cf8aac51f6f6cd0ac509885adb Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Wed, 3 May 2023 12:17:56 -0700 Subject: [PATCH] CLI-1046: user_name is null (#384) * CLI-1046: user_name is null * use coalescing operator * Add db id --- src/Response/DatabaseResponse.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Response/DatabaseResponse.php b/src/Response/DatabaseResponse.php index 96e9aea0..0067abd3 100644 --- a/src/Response/DatabaseResponse.php +++ b/src/Response/DatabaseResponse.php @@ -4,23 +4,27 @@ class DatabaseResponse { + public string $id; public string $name; - public string $user_name; - public string $password; - public string $url; + // Connection details will be missing without the required permission: + // "View database connection details (username, password, or hostname)" + public ?string $user_name; + public ?string $password; + public ?string $url; public string $db_host; - public string $ssh_host; + public ?string $ssh_host; public object $flags; public object $environment; public function __construct(object $database) { + $this->id = $database->id; $this->name = $database->name; - $this->user_name = $database->user_name; - $this->password = $database->password; - $this->url = $database->url; + $this->user_name = $database->user_name ?? null; + $this->password = $database->password ?? null; + $this->url = $database->url ?? null; $this->db_host = $database->db_host; - $this->ssh_host = $database->ssh_host; + $this->ssh_host = $database->ssh_host ?? null; $this->flags = $database->flags; $this->environment = $database->environment; }