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

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