summaryrefslogtreecommitdiff
path: root/src/http/Support
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/Support')
-rw-r--r--src/http/Support/RouteLoader.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/http/Support/RouteLoader.php b/src/http/Support/RouteLoader.php
new file mode 100644
index 0000000..b0e74cb
--- /dev/null
+++ b/src/http/Support/RouteLoader.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace App\http\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)
+ );
+ }
+}