Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/Listener/RoutingMetadataSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/**
Expand Down
Loading