<?php declare(strict_types=1);
/**
* gb media
* All Rights Reserved.
*
* Unauthorized copying of this file, via any medium is strictly prohibited.
* The content of this file is proprietary and confidential.
*
* @category Shopware
* @package Shopware_Plugins
* @subpackage GbmedDocumentBarcode
* @copyright Copyright (c) 2019, gb media
* @license proprietary
* @author Giuseppe Bottino
* @link http://www.gb-media.biz
*/
namespace Gbmed\DocumentBarcode\Core\Checkout\Document;
use Shopware\Core\Checkout\Document\Event\DocumentOrderCriteriaEvent;
use Shopware\Core\Framework\DataAbstractionLayer\Exception\InconsistentCriteriaIdsException;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class DocumentOrderCriteria implements EventSubscriberInterface
{
/**
* subscribe events
*
* @return array
*/
public static function getSubscribedEvents(): array
{
return [
DocumentOrderCriteriaEvent::class => 'onDocumentOrderCriteria'
];
}
/**
* add association
*
* @param DocumentOrderCriteriaEvent $event
* @throws InconsistentCriteriaIdsException
*/
public function onDocumentOrderCriteria(DocumentOrderCriteriaEvent $event): void
{
$event->getCriteria()->addAssociation('lineItems.product');
}
}