custom/plugins/WxLoadImages/src/Subscriber/MySubscriber.php line 17

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Wx\LoadImages\Subscriber;
  3. use Shopware\Core\Content\Product\Events\ProductListingCriteriaEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. class MySubscriber implements EventSubscriberInterface
  6. {
  7.     public static function getSubscribedEvents(): array
  8.     {
  9.         return [
  10.             ProductListingCriteriaEvent::class => 'handleRequest',
  11.         ];
  12.     }
  13.     public function handleRequest(ProductListingCriteriaEvent $event): void
  14.     {
  15.         $event
  16.             ->getCriteria()
  17.             ->addAssociation('media');
  18.     }
  19. }