From d448abcf41c406e219ccbfdd38d794627ec8757a Mon Sep 17 00:00:00 2001 From: silverbackdan Date: Fri, 27 Jan 2023 17:49:56 +0000 Subject: [PATCH] Remove todos - github issues added --- src/Factory/Uploadable/MediaObjectFactory.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Factory/Uploadable/MediaObjectFactory.php b/src/Factory/Uploadable/MediaObjectFactory.php index 0b049f8b..1da100a4 100644 --- a/src/Factory/Uploadable/MediaObjectFactory.php +++ b/src/Factory/Uploadable/MediaObjectFactory.php @@ -60,12 +60,13 @@ public function createMediaObjects(object $object): ?ArrayCollection foreach ($configuredProperties as $fileProperty => $fieldConfiguration) { $propertyMediaObjects = []; - // todo: we may need to look at the performance of this when getting the components. yes, the response is cached, but even first load on a page with lots of files, could be very bad + $filesystem = $this->filesystemProvider->getFilesystem($fieldConfiguration->adapter); $path = $classMetadata->getFieldValue($object, $fieldConfiguration->property); if (!$path) { continue; } + if (!$filesystem->fileExists($path)) { continue; } @@ -160,8 +161,6 @@ private function createFromImagine(string $contentUrl, string $path, string $ima return $this->populateMediaObjectFromCache($mediaObject, $fileInfo); } - // todo: check why we are setting this, from imagine we should know this info I'm guessing - // todo: should we not save the info to cache as well as above? $mediaObject->width = $mediaObject->height = $mediaObject->fileSize = -1; $mediaObject->mimeType = '';