custom/plugins/EnetProductStoreSalesChannel/src/Subscriber/TestSubscriber.php line 41

Open in your IDE?
  1. <?php
  2. namespace EnetProductStoreSalesChannel\Subscriber;
  3. use Shopware\Core\Framework\Context;
  4. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
  5. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
  6. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  7. use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult;
  8. use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\ContainsFilter;
  9. use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
  10. use Shopware\Core\System\SalesChannel\Entity\SalesChannelRepository;
  11. use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent;
  12. use Shopware\Storefront\Page\PageLoadedEvent;
  13. use Shopware\Storefront\Pagelet\Header\HeaderPageletLoadedEvent;
  14. use Shopware\Storefront\Pagelet\PageletLoadedEvent;
  15. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  16. class TestSubscriber implements EventSubscriberInterface
  17. {
  18.     /** @var SalesChannelRepository $salesChannelRepository */
  19.     private $salesChannelRepository;
  20.     private $container;
  21.     public function __construct(EntityRepository $salesChannelRepository$container)
  22.     {
  23.         $this->salesChannelRepository $salesChannelRepository;
  24.         $this->container $container;
  25.     }
  26.     public static function getSubscribedEvents()
  27.     {
  28.         return [
  29.             HeaderPageletLoadedEvent::class => 'onSalesChannelLoaded',
  30.         ];
  31.     }
  32.     public function onSalesChannelLoaded(PageletLoadedEvent $event)
  33.     {
  34. //        /** @var EntityRepositoryInterface $repo */
  35. //        $repo = $this->container->get('enet_product_saleschannel_stock.repository');
  36. //        $cust = $repo->search(
  37. //            (new Criteria())->addFilter(new EqualsFilter('disabled', true)),
  38. //            Context::createDefaultContext()
  39. //        );
  40. //        dump($cust->getElements()); die();
  41.     }
  42. }