Skip to content

Commit 97404b3

Browse files
committed
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.
1 parent 4ad343b commit 97404b3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
158158
$condition = $globals['condition'];
159159
}
160160

161-
$route = new Route($globals['path'].$annot->getPath(), $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
161+
$route = $this->createRoute($globals['path'].$annot->getPath(), $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
162162

163163
$this->configureRoute($route, $class, $method, $annot);
164164

@@ -259,5 +259,10 @@ protected function getGlobals(\ReflectionClass $class)
259259
return $globals;
260260
}
261261

262+
protected function createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition)
263+
{
264+
return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
265+
}
266+
262267
abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot);
263268
}

0 commit comments

Comments
 (0)