PHP Class Symfony\Component\Routing\Loader\AnnotationClassLoader

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 pattern. The annotation also recognizes three parameters: requirements, options, 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() { } }
Author: Fabien Potencier ([email protected])
Inheritance: implements Symfony\Component\Routing\Loader\LoaderInterface
Show file Open project: pmjones/php-framework-benchmarks Class Usage Examples

Protected Properties

Property Type Description
$defaultRouteIndex
$reader
$routeAnnotationClass

Public Methods

Method Description
__construct ( AnnotationReader $reader ) Constructor.
__construct ( Doctrine\Common\Annotations\Reader $reader ) Constructor.
getResolver ( ) : Symfony\Component\Config\Loader\LoaderResolver Gets the loader resolver.
getResolver ( ) : LoaderResolver Gets the loader resolver.
load ( string $class ) : RouteCollection Loads from annotations from a class.
load ( string $class, string $type = null ) : RouteCollection Loads from annotations from a class.
setResolver ( Symfony\Component\Config\Loader\LoaderResolver $resolver ) Sets the loader resolver.
setResolver ( LoaderResolver $resolver ) Sets the loader resolver.
setRouteAnnotationClass ( string $class ) Sets the annotation class to read route properties from.
supports ( mixed $resource ) : boolean Returns true if this class supports the given resource.
supports ( mixed $resource, string $type = null ) : boolean Returns true if this class supports the given resource.

Protected Methods

Method Description
addRoute ( RouteCollection $collection, $annot, $globals, ReflectionClass $class, ReflectionMethod $method )
configureRoute ( Symfony\Component\Routing\Route $route, ReflectionClass $class, ReflectionMethod $method )
configureRoute ( Symfony\Component\Routing\Route $route, ReflectionClass $class, ReflectionMethod $method, $annot )
getDefaultRouteName ( ReflectionClass $class, ReflectionMethod $method )
getDefaultRouteName ( ReflectionClass $class, ReflectionMethod $method ) : string Gets the default route name for a class method.

Method Details

__construct() public method

Constructor.
public __construct ( AnnotationReader $reader )
$reader Doctrine\Common\Annotations\AnnotationReader

__construct() public method

Constructor.
public __construct ( Doctrine\Common\Annotations\Reader $reader )
$reader Doctrine\Common\Annotations\Reader

addRoute() protected method

protected addRoute ( RouteCollection $collection, $annot, $globals, ReflectionClass $class, ReflectionMethod $method )
$collection Symfony\Component\Routing\RouteCollection
$class ReflectionClass
$method ReflectionMethod

configureRoute() abstract protected method

abstract protected configureRoute ( Symfony\Component\Routing\Route $route, ReflectionClass $class, ReflectionMethod $method )
$route Symfony\Component\Routing\Route
$class ReflectionClass
$method ReflectionMethod

configureRoute() abstract protected method

abstract protected configureRoute ( Symfony\Component\Routing\Route $route, ReflectionClass $class, ReflectionMethod $method, $annot )
$route Symfony\Component\Routing\Route
$class ReflectionClass
$method ReflectionMethod

getDefaultRouteName() protected method

protected getDefaultRouteName ( ReflectionClass $class, ReflectionMethod $method )
$class ReflectionClass
$method ReflectionMethod

getDefaultRouteName() protected method

Gets the default route name for a class method.
protected getDefaultRouteName ( ReflectionClass $class, ReflectionMethod $method ) : string
$class ReflectionClass
$method ReflectionMethod
return string

getResolver() public method

Gets the loader resolver.
public getResolver ( ) : Symfony\Component\Config\Loader\LoaderResolver
return Symfony\Component\Config\Loader\LoaderResolver A LoaderResolver instance

getResolver() public method

Gets the loader resolver.
public getResolver ( ) : LoaderResolver
return LoaderResolver A LoaderResolver instance

load() public method

Loads from annotations from a class.
public load ( string $class ) : RouteCollection
$class string A class name
return Symfony\Component\Routing\RouteCollection A RouteCollection instance

load() public method

Loads from annotations from a class.
public load ( string $class, string $type = null ) : RouteCollection
$class string A class name
$type string The resource type
return Symfony\Component\Routing\RouteCollection A RouteCollection instance

setResolver() public method

Sets the loader resolver.
public setResolver ( Symfony\Component\Config\Loader\LoaderResolver $resolver )
$resolver Symfony\Component\Config\Loader\LoaderResolver A LoaderResolver instance

setResolver() public method

Sets the loader resolver.
public setResolver ( LoaderResolver $resolver )
$resolver LoaderResolver A LoaderResolver instance

setRouteAnnotationClass() public method

Sets the annotation class to read route properties from.
public setRouteAnnotationClass ( string $class )
$class string A fully-qualified class name

supports() public method

Returns true if this class supports the given resource.
public supports ( mixed $resource ) : boolean
$resource mixed A resource
return boolean true if this class supports the given resource, false otherwise

supports() public method

Returns true if this class supports the given resource.
public supports ( mixed $resource, string $type = null ) : boolean
$resource mixed A resource
$type string The resource type
return boolean True if this class supports the given resource, false otherwise

Property Details

$defaultRouteIndex protected property

protected $defaultRouteIndex

$reader protected property

protected $reader

$routeAnnotationClass protected property

protected $routeAnnotationClass