diff --git a/src/Router/AdminRouteGenerator.php b/src/Router/AdminRouteGenerator.php index cf639eb63a..18efbccf73 100644 --- a/src/Router/AdminRouteGenerator.php +++ b/src/Router/AdminRouteGenerator.php @@ -309,6 +309,11 @@ private function getCustomActionsConfig(string $crudControllerFqcn): array throw new \RuntimeException(sprintf('In the "%s" CRUD controller, the #[AdminAction] attribute applied to the "%s()" action includes some unsupported keys. You can only define these keys: "routePath", "routeName", and "methods".', $crudControllerFqcn, $action)); } + $customActionsConfig[$action] = [ + 'routeName' => $action, + 'routePath' => '{entityId}/'.$action, + ]; + if (null !== $attributeInstance->routePath) { if (\in_array($action, ['edit', 'detail', 'delete'], true) && !str_contains($attributeInstance->routePath, '{entityId}')) { throw new \RuntimeException(sprintf('In the "%s" CRUD controller, the #[AdminAction] attribute applied to the "%s()" action is missing the "{entityId}" placeholder in its route path.', $crudControllerFqcn, $action));