Skip to content

Commit

Permalink
Add createRoute method for AnnotationClassLoader
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
henrikbjorn committed Jan 23, 2014
1 parent 4ad343b commit 97404b3
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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 97404b3

Please sign in to comment.