Path

ez components / documentation / api reference / 2008.2 / mvctools


eZ Components 2008.2

MvcTools: ezcMvcRailsRoute

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcMvcRailsRoute

Router class that uses rails style expressions for matching routes. [source]

Implemented Interfaces

The routes are matched against the uri property of the request object.

Member Variables

protected string $action
Contains the action that the controller should execute.
protected string $controllerClassName
This is the name of the controller class that will be instantiated with the request variables obtained from the route, as well as the default values belonging to a route.
protected array(string) $defaultValues
The default values for the variables that are send to the controller.

The route matchers can override those default values
protected string $pattern
This property contains the pattern

Method Summary

public ezcMvcRailsRoute __construct( $pattern, $controllerClassName, [$action = null], [$defaultValues = array()] )
Constructs a new ezcMvcRailsRoute with $pattern.
protected bool match( $request, &$matches, $matches )
This method performs the actual pattern match against the $request's URI.
public null|ezcMvcRoutingInformation matches( $request )
Evaluates the URI against this route.
public void prefix( $prefix )
Adds the $prefix to the route's pattern.

Methods

__construct

ezcMvcRailsRoute __construct( string $pattern, string $controllerClassName, [string $action = null], [ $defaultValues = array()] )
Constructs a new ezcMvcRailsRoute with $pattern.
When the route is matched (with the match() method), the route instantiates an object of the class $controllerClassName.

Parameters

Name Type Description
$pattern string  
$controllerClassName string  
$action string  
$defaultValues array(string)  

match

bool match( ezcMvcRequest $request, &$matches, array(string) $matches )
This method performs the actual pattern match against the $request's URI.

Parameters

Name Type Description
$request ezcMvcRequest  
$matches array(string)  
&$matches  

matches

null|ezcMvcRoutingInformation matches( ezcMvcRequest $request )
Evaluates the URI against this route.
The method first runs the match. If the pattern matches, it then creates an object containing routing information and returns it. If the route's pattern did not match it returns null.

Parameters

Name Type Description
$request ezcMvcRequest  

prefix

void prefix( mixed $prefix )
Adds the $prefix to the route's pattern.
It's up to the developer to provide a meaningfull prefix. In this case, it needs to be a pattern just like the normal pattern.

Parameters

Name Type Description
$prefix mixed  

Last updated: Mon, 05 Jan 2009