Skip to content

Commit

Permalink
Tweak implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Jan 7, 2025
1 parent f09fbd3 commit 7546ef4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Router/AdminRouteGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,11 @@ private function getDashboardsRouteConfig(): array
$reflectionClass = new \ReflectionClass($dashboardController);
$indexMethod = $reflectionClass->getMethod('index');

if (class_exists(\Symfony\Component\Routing\Attribute\Route::class)) {
$attributes = $indexMethod->getAttributes(\Symfony\Component\Routing\Attribute\Route::class);
}

if (!isset($attributes) || [] === $attributes) {
$attributes = $indexMethod->getAttributes(\Symfony\Component\Routing\Annotation\Route::class);
// for BC reasons, the Symfony Route attribute is available under two different namespaces;
// true first the recommended namespace and then fall back to the legacy namespace
$attributes = $indexMethod->getAttributes('Symfony\Component\Routing\Attribute\Route');
if ([] === $attributes) {
$attributes = $indexMethod->getAttributes('Symfony\Component\Routing\Annotation\Route');
}

if ([] === $attributes) {
Expand Down

0 comments on commit 7546ef4

Please sign in to comment.