From cdef6858ce644bf3eb12b2bcb7dab66f38f57b03 Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Fri, 16 Apr 2021 16:12:49 +0000 Subject: [PATCH] [ENTITY] Cache AttachmentThumbnail query result --- src/Entity/AttachmentThumbnail.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Entity/AttachmentThumbnail.php b/src/Entity/AttachmentThumbnail.php index d3e9149562..19b6fa13aa 100644 --- a/src/Entity/AttachmentThumbnail.php +++ b/src/Entity/AttachmentThumbnail.php @@ -124,8 +124,7 @@ class AttachmentThumbnail extends Entity return DB::findOneBy('attachment_thumbnail', ['attachment_id' => $attachment->getId(), 'width' => $width, 'height' => $height]); }); } catch (NotFoundException $e) { - $thumbnail = self::create(['attachment_id' => $attachment->getId(), 'width' => $width, 'height' => $height, 'attachment' => $attachment]); - + $thumbnail = self::create(['attachment_id' => $attachment->getId(), 'width' => $width, 'height' => $height, 'attachment' => $attachment]); $event_map = ['image' => 'ResizeImage', 'video' => 'ResizeVideo']; $major_mime = Media::mimetypeMajor($attachment->getMimetype()); if (in_array($major_mime, array_keys($event_map))) {