custom/plugins/GbmedDocumentBarcode/src/Core/Checkout/Document/DocumentOrderCriteria.php line 44

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. /**
  3.  * gb media
  4.  * All Rights Reserved.
  5.  *
  6.  * Unauthorized copying of this file, via any medium is strictly prohibited.
  7.  * The content of this file is proprietary and confidential.
  8.  *
  9.  * @category       Shopware
  10.  * @package        Shopware_Plugins
  11.  * @subpackage     GbmedDocumentBarcode
  12.  * @copyright      Copyright (c) 2019, gb media
  13.  * @license        proprietary
  14.  * @author         Giuseppe Bottino
  15.  * @link           http://www.gb-media.biz
  16.  */
  17. namespace Gbmed\DocumentBarcode\Core\Checkout\Document;
  18. use Shopware\Core\Checkout\Document\Event\DocumentOrderCriteriaEvent;
  19. use Shopware\Core\Framework\DataAbstractionLayer\Exception\InconsistentCriteriaIdsException;
  20. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  21. class DocumentOrderCriteria implements EventSubscriberInterface
  22. {
  23.     /**
  24.      * subscribe events
  25.      *
  26.      * @return array
  27.      */
  28.     public static function getSubscribedEvents(): array
  29.     {
  30.         return [
  31.             DocumentOrderCriteriaEvent::class => 'onDocumentOrderCriteria'
  32.         ];
  33.     }
  34.     /**
  35.      * add association
  36.      *
  37.      * @param DocumentOrderCriteriaEvent $event
  38.      * @throws InconsistentCriteriaIdsException
  39.      */
  40.     public function onDocumentOrderCriteria(DocumentOrderCriteriaEvent $event): void
  41.     {
  42.         $event->getCriteria()->addAssociation('lineItems.product');
  43.     }
  44. }