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.
This commit is contained in:
parent
4ad343bd0f
commit
97404b3614
@ -158,7 +158,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
|
||||
$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 @@ abstract class AnnotationClassLoader implements LoaderInterface
|
||||
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user