Path

ez components / documentation / api reference / 2009.2.1 / mvctools


eZ Components 2009.2.1

MvcTools: ezcMvcController

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

Class: ezcMvcController

Interface defining controller classes. [source]
Controllers process the client's request and returns variables usable by the view-manager in an instance of an ezcMvcResult. Controllers should not access request variables directly but should use the passed ezcMvcRequest. The process is done through the createResult() method, but is not limited to use protected nor private methods. The result of running a controller is an instance of ezcMvcResult.

Member Variables

protected string $action
Contains the action to run
protected ezcMvcRequest $request
Contains the original request

Method Summary

public ezcMvcController __construct( $action, $request )
Creates a new controller object and sets all the request variables as class variables.
public static string createActionMethodName( $action )
Creates a method name to call from an $action name.
public ezcMvcResult|ezcMvcInternalRedirect createResult( )
Runs the controller to process the query and return variables usable to render the view.
public ezcMvcRouter getRouter( )
Returns the router associated with this request.
protected void setRequestVariables( $request )
Loops over all the variables in the request, and sets them as object properties.
public void setRouter( $router )
Sets the router associated with this request.

Methods

__construct

ezcMvcController __construct( string $action, ezcMvcRequest $request )
Creates a new controller object and sets all the request variables as class variables.

Parameters

Name Type Description
$action string  
$request ezcMvcRequest  

Throws

ClassDescription
ezcMvcControllerException if the action method is empty

createActionMethodName

string createActionMethodName( string $action )
Creates a method name to call from an $action name.

Parameters

Name Type Description
$action string  

createResult

Runs the controller to process the query and return variables usable to render the view.

Throws

ClassDescription
ezcMvcActionNotFoundException if the action method could not be found

getRouter

ezcMvcRouter getRouter( )
Returns the router associated with this request.

setRequestVariables

void setRequestVariables( ezcMvcRequest $request )
Loops over all the variables in the request, and sets them as object properties.

Parameters

Name Type Description
$request ezcMvcRequest  

setRouter

void setRouter( ezcMvcRouter $router )
Sets the router associated with this request.

Parameters

Name Type Description
$router ezcMvcRouter  

Last updated: Tue, 23 Mar 2010