Skip to content

Commit

Permalink
feature #10112 [Routing] Add createRoute method for AnnotationClassLo…
Browse files Browse the repository at this point in the history
…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 774674e
Showing 1 changed file with 6 additions and 1 deletion.
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 774674e

Please sign in to comment.