diff options
Diffstat (limited to 'src/http/Support/RouteLoader.php')
-rw-r--r-- | src/http/Support/RouteLoader.php | 13 |
1 files changed, 6 insertions, 7 deletions
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; } } |