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

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.     /**
  9.      * @internal
  10.      */
  11.     public function __construct(WebhookDispatcher $dispatcher)
  12.     {
  13.         $this->dispatcher $dispatcher;
  14.     }
  15.     public static function getSubscribedEvents(): array
  16.     {
  17.         return [
  18.             'webhook.written' => 'clearWebhookCache',
  19.             'acl_role.written' => 'clearPrivilegesCache',
  20.         ];
  21.     }
  22.     /**
  23.      * Reset can not be handled by the Dispatcher itself, as it may be in the middle of a decoration chain
  24.      * Therefore tagging that service directly won't work
  25.      */
  26.     public function reset(): void
  27.     {
  28.         $this->clearWebhookCache();
  29.         $this->clearPrivilegesCache();
  30.     }
  31.     public function clearWebhookCache(): void
  32.     {
  33.         $this->dispatcher->clearInternalWebhookCache();
  34.     }
  35.     public function clearPrivilegesCache(): void
  36.     {
  37.         $this->dispatcher->clearInternalPrivilegesCache();
  38.     }
  39. }