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

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\Log\Package;
  5. use Shopware\Core\Framework\Script\Execution\ScriptExecutor;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. /**
  8.  * @internal
  9.  */
  10. #[Package('core')]
  11. class ScriptCacheInvalidationSubscriber implements EventSubscriberInterface
  12. {
  13.     private ScriptExecutor $scriptExecutor;
  14.     public function __construct(ScriptExecutor $scriptExecutor)
  15.     {
  16.         $this->scriptExecutor $scriptExecutor;
  17.     }
  18.     public static function getSubscribedEvents(): array
  19.     {
  20.         return [
  21.             EntityWrittenContainerEvent::class => 'executeCacheInvalidationHook',
  22.         ];
  23.     }
  24.     public function executeCacheInvalidationHook(EntityWrittenContainerEvent $event): void
  25.     {
  26.         $this->scriptExecutor->execute(
  27.             new CacheInvalidationHook($event)
  28.         );
  29.     }
  30. }