Class AnnotationClassLoader
AnnotationClassLoader loads routing information from a PHP class and its methods.
You need to define an implementation for the getRouteDefaults() method. Most of the time, this method should define some PHP callable to be called for the route (a controller in MVC speak).
The @Route annotation can be set on the class (for global parameters), and on each method.
The @Route annotation main value is the route path. The annotation also
recognizes several parameters: requirements, options, defaults, schemes,
methods, host, and name. The name parameter is mandatory. Here is an example of
how you should be able to use it:
/** * @Route("/Blog") * / class Blog { /** * @Route("/", name="blog_index") * /
public function index() { }
/** * @Route("/{id}", name="blog_post", requirements = {"id" = "\d+"}) * /
public function show() { } }
- Symfony\Component\Routing\Loader\AnnotationClassLoader implements Symfony\Component\Config\Loader\LoaderInterface
Namespace: Symfony\Component\Routing\Loader
Author: Fabien Potencier <fabien@symfony.com>
Located at Loader/AnnotationClassLoader.php
public
|
|
public
|
|
public
|
|
protected
|
#
addRoute(
|
public
|
|
public
|
|
public
|
|
protected
string
|
#
getDefaultRouteName(
Gets the default route name for a class method. |
protected
|
|
protected
|
#
createRoute( mixed $path, mixed $defaults, mixed $requirements, mixed $options, mixed $host, mixed $schemes, mixed $methods, mixed $condition )
|
abstract protected
|
#
configureRoute(
|
protected
Doctrine\Common\Annotations\Reader
|
$reader | |
|
protected
string
|
$routeAnnotationClass | 'Symfony\\Component\\Routing\\Annotation\\Route' |
|
protected
integer
|
$defaultRouteIndex | 0 |