Apache Zeta Components Manual :: File Source for controller.php
Source for file controller.php
Documentation is available at controller.php
* File containing the ezcMvcController class
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @version //autogentag//
* Interface defining controller classes.
* 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.
* @version //autogentag//
* Contains the action to run
* Contains the original request
* Holds the properties of this class.
* @var array(string=>mixed)
private $properties =
array();
* Holds the router associated with the action
* Creates a new controller object and sets all the request variables as class variables.
* @throws ezcMvcControllerException if the action method is empty
* @param ezcMvcRequest $request
public function __construct( $action, ezcMvcRequest $request )
* Sets the property $name to $value, all properties are readonly though so
* an exception is thrown for every set.
* @throws ezcBasePropertyPermissionException if a read-only property is
public function __set( $name, $value )
* Returns the value of the property $name.
* @throws ezcBasePropertyNotFoundException if the property does not exist.
public function __get( $name )
if ( isset
( $this->properties[$name] ) )
return $this->properties[$name];
* Returns true if the property $name is set, otherwise false.
public function __isset( $name )
* Sets the router associated with this request.
* @param ezcMvcRouter $router
public function setRouter( ezcMvcRouter $router )
* Returns the router associated with this request.
* Loops over all the variables in the request, and sets them as object properties.
* @param ezcMvcRequest $request
foreach ( $request->variables as $key =>
$value )
$this->properties[$key] =
$value;
* Creates a method name to call from an $action name.
* Runs the controller to process the query and return variables usable
* @throws ezcMvcActionNotFoundException if the action method could not be found
* @return ezcMvcResult|ezcMvcInternalRedirect
$actionMethod =
self::createActionMethodName( $this->action );
return $this->$actionMethod();