custom/plugins/WeloArticleImageBills6/src/Subscriber/DocumentSubscriber.php line 28

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Welo\ArticleImageBills\Subscriber;
  3. use Shopware\Core\Checkout\Document\Event\DocumentOrderCriteriaEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. /**
  6.  * Class DocumentSubscriber
  7.  *
  8.  * @author    Cyprien Nkeneng <cyprien.nkeneng@webloupe.de> - www.webloupe.de
  9.  * @copyright Copyright (c) 2017-2020 WEB LOUPE
  10.  * @package   Welo\ArticleImageBills\Subscriber
  11.  * @link      https://www.webloupe.de
  12.  * @version   1
  13.  */
  14. class DocumentSubscriber implements EventSubscriberInterface
  15. {
  16.     /**
  17.      * {@inheritdoc}
  18.      */
  19.     public static function getSubscribedEvents(): array
  20.     {
  21.         return [
  22.             DocumentOrderCriteriaEvent::class => 'addCover',
  23.         ];
  24.     }
  25.     public function addCover(DocumentOrderCriteriaEvent $event): void
  26.     {
  27.         $criteria $event->getCriteria();
  28.         $criteria->addAssociation('lineItems.cover');
  29.     }
  30. }