custom/plugins/FroshProductCompare/src/Subscriber/FroshProductGatewayCriteriaSubscriber.php line 19

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Frosh\FroshProductCompare\Subscriber;
  3. use Shopware\Core\Content\Product\Events\ProductGatewayCriteriaEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. class FroshProductGatewayCriteriaSubscriber implements EventSubscriberInterface
  6. {
  7.     public static function getSubscribedEvents()
  8.     {
  9.         return [
  10.             ProductGatewayCriteriaEvent::class => [
  11.                 ['handleCriteriaLoadedRequest'201]
  12.             ],
  13.         ];
  14.     }
  15.     public function handleCriteriaLoadedRequest(ProductGatewayCriteriaEvent $event): void
  16.     {
  17.         $criteria $event->getCriteria();
  18.         $criteria->addAssociation('prices')->addAssociation('manufacturer');
  19.     }
  20. }