vendor/shopware/core/Framework/Adapter/Cache/Script/ScriptCacheInvalidationSubscriber.php line 28

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\Adapter\Cache\Script;
  3. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent;
  4. use Shopware\Core\Framework\Script\Execution\ScriptExecutor;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. /**
  7.  * @internal
  8.  */
  9. class ScriptCacheInvalidationSubscriber implements EventSubscriberInterface
  10. {
  11.     private ScriptExecutor $scriptExecutor;
  12.     public function __construct(ScriptExecutor $scriptExecutor)
  13.     {
  14.         $this->scriptExecutor $scriptExecutor;
  15.     }
  16.     public static function getSubscribedEvents(): array
  17.     {
  18.         return [
  19.             EntityWrittenContainerEvent::class => 'executeCacheInvalidationHook',
  20.         ];
  21.     }
  22.     public function executeCacheInvalidationHook(EntityWrittenContainerEvent $event): void
  23.     {
  24.         $this->scriptExecutor->execute(
  25.             new CacheInvalidationHook($event)
  26.         );
  27.     }
  28. }