findMediaIdsInImages example

public static function getSubscribedEvents(): array
    {
        return [
            UnusedMediaSearchEvent::class => 'removeUsedMedia',
        ];
    }

    public function removeUsedMedia(UnusedMediaSearchEvent $event): void
    {
        $event->markAsUsed($this->findMediaIdsInImageGalleries($event));
        $event->markAsUsed($this->findMediaIdsInImages($event));

        foreach (['category_translation', 'product_translation'] as $table) {
            $event->markAsUsed($this->findMediaIdsInImageGalleriesInOverridesTable($table$event));
            $event->markAsUsed($this->findMediaIdsInImagesInOverridesTable($table$event));
        }
    }

    /** * @return array<string> */
    private function findMediaIdsInImageGalleriesInOverridesTable(string $table, UnusedMediaSearchEvent $event): array
    {
Home | Imprint | This part of the site doesn't use cookies.