From 3c2420c8f42d14fe53f456e657fc03f8cf17dbe4 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 25 Apr 2024 13:34:46 +0000 Subject: [PATCH] fix tests --- Controller/ApiController.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 4afb3db..adfaab2 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -303,7 +303,7 @@ final class ApiController extends Controller * - FILE_PATH = combination of base path and virtual path * @param bool $hasAccountRelation The uploaded files should be related to an account * - * @return Media[] + * @return Collection * * @since 1.0.0 */ @@ -1013,7 +1013,7 @@ final class ApiController extends Controller } if (!$status) { - $this->app->logger?->error(\phpOMS\Log\FileLogger::MSG_FULL, [ + $this->app->logger->error(\phpOMS\Log\FileLogger::MSG_FULL, [ 'message' => 'Couldn\'t create directory "' . $physicalPath . '"', 'line' => __LINE__, 'file' => self::class, @@ -1101,7 +1101,11 @@ final class ApiController extends Controller string $collectionPath = '' ) : void { - $mediaFiles = MediaMapper::getAll()->where('id', $files)->executeGetArray(); + /** @var \Modules\Media\Models\Media[] $mediaFiles */ + $mediaFiles = MediaMapper::getAll() + ->where('id', $files) + ->executeGetArray(); + $collection = null; foreach ($mediaFiles as $media) { @@ -1109,7 +1113,7 @@ final class ApiController extends Controller $this->createModelRelation($account, $rel, $media->id, $mapper, $field, '', '127.0.0.1'); } - if (!empty($addToCollection)) { + if (!empty($collectionPath)) { $ref = new Reference(); $ref->name = $media->name; $ref->source = new NullMedia($media->id);