From 35edf4b318796abf95bce9cc9e455788ba6de51d Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Fri, 16 Aug 2024 17:15:09 +0200 Subject: [PATCH] Check if a listing is an entity or an array --- lib/Service/DirectoryService.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Service/DirectoryService.php b/lib/Service/DirectoryService.php index 4ed464df..f385c9cf 100644 --- a/lib/Service/DirectoryService.php +++ b/lib/Service/DirectoryService.php @@ -100,7 +100,13 @@ private function createDirectoryFromResult(array $result, bool $update = false): ) { return null; } else if (count($this->listDirectory(filters: ['catalogId' => $result['catalogId'], 'directory' => $result['directory']])) > 0 && $update === true) { - $id = $this->listDirectory(filters: ['catalogId' => $result['catalogId'], 'directory' => $result['directory']])[0]['id']; + $listing = $this->listDirectory(filters: ['catalogId' => $result['catalogId'], 'directory' => $result['directory']])[0]; + + if($listing instanceof Listing) { + $listing = $listing->jsonSerialize(); + } + + $id = $listing['id']; } if($this->config->getValueString($this->appName, 'mongoStorage') === '1') {