public function __construct( private readonly ThumbnailService
$thumbnailService,
private readonly EntityRepository
$mediaRepository ) { } 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) {