From 97404b36143707c1589268d76b1ba8556e4faa57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bj=C3=B8rnskov?= Date: Thu, 23 Jan 2014 11:11:15 +0100 Subject: [PATCH] Add createRoute method for AnnotationClassLoader This allows to use a custom route class. So if you want to support annotations for Routing in Silex it can now be done while keeping the custom routing options Silex supports. --- .../Component/Routing/Loader/AnnotationClassLoader.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index 00a9bdfe0555c..2c5fb18199339 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -158,7 +158,7 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl $condition = $globals['condition']; } - $route = new Route($globals['path'].$annot->getPath(), $defaults, $requirements, $options, $host, $schemes, $methods, $condition); + $route = $this->createRoute($globals['path'].$annot->getPath(), $defaults, $requirements, $options, $host, $schemes, $methods, $condition); $this->configureRoute($route, $class, $method, $annot); @@ -259,5 +259,10 @@ protected function getGlobals(\ReflectionClass $class) return $globals; } + protected function createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition) + { + return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition); + } + abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot); }