diff --git a/composer.json b/composer.json index 48c0936..a2f9fc9 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "symfony/filesystem": "^5.4|^6.4|^7.0", "symfony/finder": "^5.4|^6.4|^7.0", "symfony/http-foundation": "^5.4|^6.4|^7.0", - "symfony/http-kernel": "^5.4|^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", "symfony/lock": "^5.4|^6.4|^7.0", "symfony/twig-bundle": "^5.4|^6.4|^7.0", "twig/twig": "^2.0|^3.0" diff --git a/src/Caching/EventListener.php b/src/Caching/EventListener.php index ee8dc11..6d49707 100644 --- a/src/Caching/EventListener.php +++ b/src/Caching/EventListener.php @@ -38,21 +38,19 @@ public function __construct(MetaQueryFactory $metaQueryFactory, $debug) public function onKernelController(ControllerEvent $event) { - $controller = $event->getController(); - $request = $event->getRequest(); - - $attribute = $this->findAttribute($controller); + $attributes = $event->getAttributes(Send304IfNotModified::class); - if (!$attribute) { + if (!$attributes) { return; } - $lastTouched = $attribute->calculateLastModified($this->metaQueryFactory); + $lastTouched = $attributes[0]->calculateLastModified($this->metaQueryFactory); if (!$lastTouched) { return; } + $request = $event->getRequest(); $this->lastTouchedResults[$request] = $lastTouched; /* @@ -73,7 +71,7 @@ public function onKernelController(ControllerEvent $event) if ($response->isNotModified($request)) { $event->setController(function () use ($response) { return $response; - }); + }, $event->getAttributes()); } }