Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Jan 11, 2025
1 parent 871ac6e commit 250db9f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/EventListener/AdminRouterSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@ public function onKernelRequestPrettyUrls(RequestEvent $event): void
$dashboardRoutesCachePath = $this->buildDir.'/'.CacheWarmer::DASHBOARD_ROUTES_CACHE;
$dashboardControllerRoutes = [];
if (file_exists($dashboardRoutesCachePath)) {
$dashboardControllerRoutes = require $dashboardRoutesCachePath;
try {
$dashboardControllerRoutes = require $dashboardRoutesCachePath;
} catch (\Throwable) {
}
}

// this is not a cached dashboard route, so this is case (3) a regular Symfony request
if (!\array_key_exists($request->attributes->get('_route'), $dashboardControllerRoutes)) {
return;
Expand All @@ -115,9 +119,14 @@ public function onKernelRequestPrettyUrls(RequestEvent $event): void

$dashboardControllerFqcn = $request->attributes->get(EA::DASHBOARD_CONTROLLER_FQCN);
if (null === $dashboardControllerFqcn) {
if (!isset($dashboardControllerRoutes[$request->attributes->get('_route')])) {
return;
}

$dashboardCallableAsString = $dashboardControllerRoutes[$request->attributes->get('_route')];
[$dashboardControllerFqcn, ] = explode('::', $dashboardCallableAsString);
}

if (null === $dashboardControllerInstance = $this->getDashboardControllerInstance($dashboardControllerFqcn, $request)) {
return;
}
Expand Down

0 comments on commit 250db9f

Please sign in to comment.