custom/plugins/ProcDisableCategories/src/Subscriber/CacheInvalidationSubscriber.php line 34

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Proc\DisableCategories\Subscriber;
  3. use Shopware\Core\Content\Category\CategoryDefinition;
  4. use Shopware\Core\Content\Category\Event\NavigationLoadedEvent;
  5. use Shopware\Core\Content\Category\SalesChannel\CachedNavigationRoute;
  6. use Shopware\Core\Content\Category\SalesChannel\NavigationRoute;
  7. use Shopware\Core\Framework\Adapter\Cache\CacheInvalidator;
  8. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent;
  9. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  10. use Shopware\Storefront\Page\Navigation\NavigationPageLoadedEvent;
  11. use Shopware\Storefront\Pagelet\Header\HeaderPageletLoadedEvent;
  12. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  13. class CacheInvalidationSubscriber implements EventSubscriberInterface
  14. {
  15.     private CacheInvalidator    $cacheInvalidator;
  16.     public function __construct(CacheInvalidator $cacheInvalidator)
  17.     {
  18.         $this->cacheInvalidator $cacheInvalidator;
  19.     }
  20.     public static function getSubscribedEvents()
  21.     {
  22.         return [
  23.           NavigationLoadedEvent::class => [
  24.               ['invalidate'2001]
  25.           ]
  26.         ];
  27.     }
  28.     public function invalidate(NavigationLoadedEvent $event): void
  29.     {
  30.         /*$this->cacheInvalidator->invalidate(
  31.             (array) CachedNavigationRoute::BASE_NAVIGATION_TAG
  32.         );*/
  33.     }
  34. }