Skip to content

Commit 774674e

Browse files
committed
feature #10112 [Routing] Add createRoute method for AnnotationClassLoader (henrikbjorn)
This PR was merged into the 2.5-dev branch. Discussion ---------- [Routing] Add createRoute method for AnnotationClassLoader | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ 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. Commits ------- 97404b3 Add createRoute method for AnnotationClassLoader
2 parents 4e137cc + 97404b3 commit 774674e

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)