diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-09-24 13:40:25 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-09-24 13:40:25 +0200 |
commit | fa00b957378a393f8edbfc98ef111d35d18ecb09 (patch) | |
tree | 654e7dc5414f7f2795dbe996d3e1570793a5b1b8 /src/Support/RouteLoader.php |
initial commit
Diffstat (limited to 'src/Support/RouteLoader.php')
-rw-r--r-- | src/Support/RouteLoader.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Support/RouteLoader.php b/src/Support/RouteLoader.php new file mode 100644 index 0000000..ba124c5 --- /dev/null +++ b/src/Support/RouteLoader.php @@ -0,0 +1,24 @@ +<?php + +namespace App\Support; + +use Symfony\Component\Routing\Loader\AnnotationClassLoader; +use Symfony\Component\Routing\Route; + +class RouteLoader extends AnnotationClassLoader +{ + protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annotation) { + $route->setDefault('_', compact('class', 'method', 'annotation')); + } + + protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method) + { + $name = parent::getDefaultRouteName($class, $method); + + return str_replace( + '_', + '.', + str_replace('app_controller_', '', $name) + ); + } +} |