Class ActionController

Description

The ActionController class represents the controller in the Model-View-Controller (MVC) design pattern. The ActionController receives and processes all requests that change the state of the application.

Generally, a "Model2" application is architected as follows:

  • The user interface will generally be created with either PHP pages, which will not themselves contain any business logic. These pages represent the "view" component of an MVC architecture.
  • Forms and hyperlinks in the user interface that require business logic to be executed will be submitted to a request URI that is mapped to the ActionController. The ActionController receives and processes all requests that change the state of a user's interaction with the application. This component represents the "controller" component of an MVC architecture.
  • The ActionController will select and invoke an Action class to perform the requested business logic.
  • The Action classes will manipulate the state of the application's interaction with the user, typically by creating or modifying classes that are stored as session attributes. Such classes represent the "model" component of an MVC architecture.
  • Instead of producing the next page of the user interface directly, Action classes will forward control to an appropriate PHP page to produce the next page of the user interface.
The standard version of ActionController implements the following logic for each incoming HTTP request. You can override some or all of this functionality by subclassing this class and implementing your own version of the processing.
  • Identify, from the incoming request URI, the substring that will be used to select an Action procedure.
  • Use this substring to map to the class name of the corresponding Action class (a subclass of the Action class).
  • If this is the first request for a particular Action class, instantiate an instance of that class and cache it for future use.
  • Optionally populate the properties of an ActionForm class associated with this ActionMapping and cache it for future use.
  • Call the perform() method of this Action class. Passing in the mapping and the request that were passed to the ActionController by the bootstrap.

The standard version of ActionController is configured based on the following initialization parameters, which you will specify in the options for your application. Subclasses that specialize this ActionController are free to define additional initialization parameters.

  • options - This sets the ActionController options.

  • author: Arnold Cano
  • version: $Id: ActionController.php,v 1.28.6.1 2011/10/04 11:19:40 afelixf Exp $

Located in /phrame/ActionController.php (line 56)

Object
   |
   --ActionController
Variable Summary
Method Summary
ActionController ActionController (array $options)
void process (array $mappings, array $request)
Variables
HashMap $_actionMappings (line 65)
HashMap $_actions (line 69)
array $_options (line 61)
Methods
Constructor ActionController (line 77)

Create a ActionController specifying the options.

  • access: public
ActionController ActionController (array $options)
  • array $options
process (line 95)

Process the request.

  • access: public
void process (array $mappings, array $request)
  • array $mappings
  • array $request

Inherited Methods

Inherited From Object

Object::equals()
Object::toString()

Documentation generated on Wed, 05 Oct 2011 10:36:21 +0200 by phpDocumentor 1.4.1