Permalink
Browse files

feature #10112 [Routing] Add createRoute method for AnnotationClassLo…

…ader (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
  • Loading branch information...
fabpot committed Jan 25, 2014
2 parents 4e137cc + 97404b3 commit 774674efbf60fc6a987911b30fa127afa10e7a97
Showing with 6 additions and 1 deletion.
  1. +6 −1 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);
}

0 comments on commit 774674e

Please sign in to comment.