From d58f61770463aab2c71464c11f902f0074b49b62 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 15 Jan 2024 15:50:43 +0100 Subject: http catch-up --- src/http/Support/RouteLoader.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/http/Support/RouteLoader.php') diff --git a/src/http/Support/RouteLoader.php b/src/http/Support/RouteLoader.php index b0e74cb..d11011c 100644 --- a/src/http/Support/RouteLoader.php +++ b/src/http/Support/RouteLoader.php @@ -2,10 +2,10 @@ namespace App\http\Support; -use Symfony\Component\Routing\Loader\AnnotationClassLoader; +use Symfony\Component\Routing\Loader\AttributeClassLoader; use Symfony\Component\Routing\Route; -class RouteLoader extends AnnotationClassLoader +class RouteLoader extends AttributeClassLoader { protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annotation) { $route->setDefault('_', compact('class', 'method', 'annotation')); @@ -15,10 +15,9 @@ class RouteLoader extends AnnotationClassLoader { $name = parent::getDefaultRouteName($class, $method); - return str_replace( - '_', - '.', - str_replace('app_controller_', '', $name) - ); + $name = preg_replace('/app_\w+_controller_/', '', $name); + $name = str_replace('_', '.', $name); + + return $name; } } -- cgit v1.2.3