<?php declare(strict_types=1);
namespace Welo\ArticleImageBills\Subscriber;
use Shopware\Core\Checkout\Document\Event\DocumentOrderCriteriaEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Class DocumentSubscriber
*
* @author Cyprien Nkeneng <cyprien.nkeneng@webloupe.de> - www.webloupe.de
* @copyright Copyright (c) 2017-2020 WEB LOUPE
* @package Welo\ArticleImageBills\Subscriber
* @link https://www.webloupe.de
* @version 1
*/
class DocumentSubscriber implements EventSubscriberInterface
{
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents(): array
{
return [
DocumentOrderCriteriaEvent::class => 'addCover',
];
}
public function addCover(DocumentOrderCriteriaEvent $event): void
{
$criteria = $event->getCriteria();
$criteria->addAssociation('lineItems.cover');
}
}