public function __invoke(GenerateThumbnailsMessage|UpdateThumbnailsMessage
$msg): void
{ if (Feature::
isActive('v6.6.0.0'
)) { $context =
$msg->
getContext();
} else { $context =
$msg->
readContext();
} $criteria =
new Criteria();
$criteria->
addAssociation('mediaFolder.configuration.mediaThumbnailSizes'
);
$criteria->
addFilter(new EqualsAnyFilter('media.id',
$msg->
getMediaIds()));
/** @var MediaCollection $entities */
$entities =
$this->mediaRepository->
search($criteria,
$context)->
getEntities();
if ($msg instanceof UpdateThumbnailsMessage
) { foreach ($entities as $media) { $this->thumbnailService->
updateThumbnails($media,
$context,
$msg->
isStrict());
} } else { $this->thumbnailService->
generate($entities,
$context);
} }