From 887553415960a0f60a40f59dfc660f0bafafe119 Mon Sep 17 00:00:00 2001 From: Remon van de Kamp Date: Wed, 27 May 2026 10:53:31 +0200 Subject: [PATCH] Show which features are inactive in RouteMetadataSubscriber That way it's easier to enable them without having to check route configuration first to see which feature needs to be enabled. --- src/Listener/RoutingMetadataSubscriber.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Listener/RoutingMetadataSubscriber.php b/src/Listener/RoutingMetadataSubscriber.php index cdec54e..e66e25a 100644 --- a/src/Listener/RoutingMetadataSubscriber.php +++ b/src/Listener/RoutingMetadataSubscriber.php @@ -55,11 +55,21 @@ public function onKernelController(ControllerEvent $event) } $featureNames = (array) $event->getRequest()->attributes->get(static::FEATURE_KEY); + $inactiveFeatures = []; foreach ($featureNames as $featureName) { if (!$this->manager->isActive($featureName)) { - throw new NotFoundHttpException('Feature for this class is not active.'); + $inactiveFeatures[] = $featureName; } } + + if (!empty($inactiveFeatures)) { + $last = array_pop($inactiveFeatures); + $message = count($inactiveFeatures) > 0 + ? sprintf('Features "%s" and "%s" are not active.', implode('", "', $inactiveFeatures), $last) + : sprintf('Feature "%s" is not active.', $last); + + throw new NotFoundHttpException($message); + } } /**