YAF_REQUEST_ABSTRACT(3) 1 YAF_REQUEST_ABSTRACT(3)The Yaf_Request_Abstract classINTRODUCTION CLASS SYNOPSIS
Yaf_Request_Abstract
Yaf_Request_Abstract
Constants
o const string$Yaf_Request_Abstract::SCHEME_HTTPhttp
o const string$Yaf_Request_Abstract::SCHEME_HTTPShttps
Properties
o public$module
o public$controller
o public$action
o public$method
o protected$params
o protected$language
o protected$_exception
o protected$_base_uri
o protected$uri
o protected$dispatched
o protected$routed
Methods
o public void Yaf_Request_Abstract::getActionName (void )
o public void Yaf_Request_Abstract::getBaseUri (void )
o public void Yaf_Request_Abstract::getControllerName (void )
o public void Yaf_Request_Abstract::getEnv (string $name, [string $default])
o public void Yaf_Request_Abstract::getException (void )
o public void Yaf_Request_Abstract::getLanguage (void )
o public void Yaf_Request_Abstract::getMethod (void )
o public void Yaf_Request_Abstract::getModuleName (void )
o public void Yaf_Request_Abstract::getParam (string $name, [string $default])
o public void Yaf_Request_Abstract::getParams (void )
o public void Yaf_Request_Abstract::getRequestUri (void )
o public void Yaf_Request_Abstract::getServer (string $name, [string $default])
o public void Yaf_Request_Abstract::isCli (void )
o public void Yaf_Request_Abstract::isDispatched (void )
o public void Yaf_Request_Abstract::isGet (void )
o public void Yaf_Request_Abstract::isHead (void )
o public void Yaf_Request_Abstract::isOptions (void )
o public void Yaf_Request_Abstract::isPost (void )
o public void Yaf_Request_Abstract::isPut (void )
o public void Yaf_Request_Abstract::isRouted (void )
o public void Yaf_Request_Abstract::isXmlHttpRequest (void )
o public void Yaf_Request_Abstract::setActionName (string $action)
o public bool Yaf_Request_Abstract::setBaseUri (string $uir)
o public void Yaf_Request_Abstract::setControllerName (string $controller)
o public void Yaf_Request_Abstract::setDispatched (void )
o public void Yaf_Request_Abstract::setModuleName (string $module)
o public void Yaf_Request_Abstract::setParam (string $name, [string $value])
o public void Yaf_Request_Abstract::setRequestUri (string $uir)
o public void Yaf_Request_Abstract::setRouted ([string $flag])
PROPERTIES
o $module
-
o $controller
-
o $action
-
o $method
-
o $params
-
o $language
-
o $_exception
-
o $_base_uri
-
o $uri
-
o $dispatched
-
o $routed
-
PREDEFINED CONSTANTS
o Yaf_Request_Abstract::SCHEME_HTTP -
o Yaf_Request_Abstract::SCHEME_HTTPS -
PHP Documentation Group YAF_REQUEST_ABSTRACT(3)
Check Out this Related Man Page
YAF_CONTROLLER_ABSTRACT(3) 1 YAF_CONTROLLER_ABSTRACT(3)The Yaf_Controller_Abstract classINTRODUCTION
Yaf_Controller_Abstract is the heart of Yaf's system. MVC stands for Model-View-Controller and is a design pattern targeted at separating
application logic from display logic.
Every custom controller shall inherit Yaf_Controller_Abstract.
You will find that you can not define __construct function for your custom controller, thus, Yaf_Controller_Abstract provides a magic
method: Yaf_Controller_Abstract::init.
If you have defined a init() method in your custom controller, it will be called as long as the controller was instantiated.
Action may have arguments, when a request coming, if there are the same name variable in the request parameters(see
Yaf_Request_Abstract::getParam) after routed, Yaf will pass them to the action method (see Yaf_Action_Abstract::execute).
Note
These arguments are directly fetched without filtering, it should be carefully processed before use them.
CLASS SYNOPSIS
Yaf_Controller_Abstract
abstract
Yaf_Controller_Abstract
Properties
o public$actions
o protected$_module
o protected$_name
o protected$_request
o protected$_response
o protected$_invoke_args
o protected$_view
Methods
o finalprivate void Yaf_Controller_Abstract::__clone (void )
o finalprivate Yaf_Controller_Abstract::__construct (void )
o protected bool Yaf_Controller_Abstract::display (string $tpl, [array $parameters])
o public void Yaf_Controller_Abstract::forward (string $action, [array $paramters])
o public void Yaf_Controller_Abstract::getInvokeArg (string $name)
o public void Yaf_Controller_Abstract::getInvokeArgs (void )
o public string Yaf_Controller_Abstract::getModuleName (void )
o public Yaf_Request_Abstract Yaf_Controller_Abstract::getRequest (void )
o public Yaf_Response_Abstract Yaf_Controller_Abstract::getResponse (void )
o public Yaf_View_Interface Yaf_Controller_Abstract::getView (void )
o public void Yaf_Controller_Abstract::getViewpath (void )
o public void Yaf_Controller_Abstract::init (void )
o public void Yaf_Controller_Abstract::initView ([array $options])
o public bool Yaf_Controller_Abstract::redirect (string $url)
o protected string Yaf_Controller_Abstract::render (string $tpl, [array $parameters])
o public void Yaf_Controller_Abstract::setViewpath (string $view_directory)
PROPERTIES
o $actions
- You can also define a action method in a separate PHP script by using this property and Yaf_Action_Abstract.
Example #1
define action in a separate file
<?php
class IndexController extends Yaf_Controller_Abstract {
protected $actions = array(
/** now dummyAction is defined in a separate file */
"dummy" => "actions/Dummy_action.php",
);
/* action method may have arguments */
public indexAction($name, $id) {
/* $name and $id are unsafe raw data */
assert($name == $this->getRequest()->getParam("name"));
assert($id == $this->_request->getParam("id"));
}
}
?>
Example #2
Dummy_action.php
<?php
class DummyAction extends Yaf_Action_Abstract {
/* a action class shall define this method as the entry point */
public execute() {
}
}
?>
o $_module
- module name
o $_name
- controller name
o $_request
- current request object
o $_response
- current response object
o $_invoke_args
-
o $_view
- view engine object
PHP Documentation Group YAF_CONTROLLER_ABSTRACT(3)