vendor/ibexa/http-cache/src/lib/EventSubscriber/CachePurge/UrlEventsSubscriber.php line 22

Open in your IDE?
  1. <?php
  2. /**
  3. * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4. * @license For full copyright and license information view LICENSE file distributed with this source code.
  5. */
  6. declare(strict_types=1);
  7. namespace Ibexa\HttpCache\EventSubscriber\CachePurge;
  8. use Ibexa\Contracts\Core\Repository\Events\URL\UpdateUrlEvent;
  9. final class UrlEventsSubscriber extends AbstractSubscriber
  10. {
  11. public static function getSubscribedEvents(): array
  12. {
  13. return [
  14. UpdateUrlEvent::class => 'onUrlUpdate',
  15. ];
  16. }
  17. public function onUrlUpdate(UpdateUrlEvent $event): void
  18. {
  19. $urlId = $event->getUpdatedUrl()->id;
  20. if ($event->getStruct()->url !== null) {
  21. $this->purgeClient->purge(
  22. $this->getContentUrlTags($urlId)
  23. );
  24. }
  25. }
  26. }
  27. class_alias(UrlEventsSubscriber::class, 'EzSystems\PlatformHttpCacheBundle\EventSubscriber\CachePurge\UrlEventsSubscriber');