vendor/shopware/core/Framework/Webhook/WebhookCacheClearer.php line 48

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\Webhook;
  3. use Shopware\Core\Framework\Log\Package;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use Symfony\Contracts\Service\ResetInterface;
  6. /**
  7.  * @deprecated tag:v6.5.0 - reason:becomes-internal - EventSubscribers will become internal in v6.5.0
  8.  */
  9. #[Package('core')]
  10. class WebhookCacheClearer implements EventSubscriberInterfaceResetInterface
  11. {
  12.     private WebhookDispatcher $dispatcher;
  13.     /**
  14.      * @internal
  15.      */
  16.     public function __construct(WebhookDispatcher $dispatcher)
  17.     {
  18.         $this->dispatcher $dispatcher;
  19.     }
  20.     public static function getSubscribedEvents(): array
  21.     {
  22.         return [
  23.             'webhook.written' => 'clearWebhookCache',
  24.             'acl_role.written' => 'clearPrivilegesCache',
  25.         ];
  26.     }
  27.     /**
  28.      * Reset can not be handled by the Dispatcher itself, as it may be in the middle of a decoration chain
  29.      * Therefore tagging that service directly won't work
  30.      */
  31.     public function reset(): void
  32.     {
  33.         $this->clearWebhookCache();
  34.         $this->clearPrivilegesCache();
  35.     }
  36.     public function clearWebhookCache(): void
  37.     {
  38.         $this->dispatcher->clearInternalWebhookCache();
  39.     }
  40.     public function clearPrivilegesCache(): void
  41.     {
  42.         $this->dispatcher->clearInternalPrivilegesCache();
  43.     }
  44. }