本文整理汇总了PHP中Zend_Controller_Action::dispatch方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Action::dispatch方法的具体用法?PHP Zend_Controller_Action::dispatch怎么用?PHP Zend_Controller_Action::dispatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Action
的用法示例。
在下文中一共展示了Zend_Controller_Action::dispatch方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
/**
* @param string $action
* @return Api_Controller_Response_Result
* @throws Api_Exception_BadMethodCall
*/
public function dispatch($action)
{
try {
$action = $this->_getRestAction();
if (!$action) {
throw new Api_Exception_BadMethodCall();
}
$this->_request->setActionName($action);
$dto = $this->_dtoManager->createFromMethod($this, $action . 'Action');
if (!$dto) {
parent::dispatch($action . 'Action');
$result = $this->_getDispatchedResult();
} else {
$this->_annotationManager->populateDtoFromArray($dto, $this->_getParams());
$result = call_user_func_array([$this, $action . 'Action'], [$dto]);
}
} catch (Api_Exception_BadMethodCall $e) {
$result = $this->_createError('not found', Api_Controller_Response_Result::NOT_FOUND);
} catch (Api_Exception_NoArgument $e) {
$result = $this->_createError($e->getMessage(), Api_Controller_Response_Result::BAD_REQUEST);
} catch (Exception $e) {
$result = $this->_createError('internal error', Api_Controller_Response_Result::INTERNAL);
}
$this->_response->setHttpResponseCode($result->getCode());
if ($result->getCode() != Api_Controller_Response_Result::NO_CONTENT) {
if ($result->getLocation()) {
$this->_response->setHeader('Location', $result->getLocation());
}
$raw = $this->_getRawResult($result);
$this->_helper->json($raw);
}
}
示例2: dispatch
/**
* Checks to see whether or not there needs to be any request method
* filtering before executing $action.
*
* @param string $action Method name of action
* @return void
*/
public function dispatch($action)
{
try {
$this->filterRequest($action);
$this->validateRequestAction($action);
parent::dispatch($action);
} catch (Exception $e) {
// add a 500 header
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
echo $e->getMessage();
}
throw $e;
}
}
示例3: dispatch
/**
* cheezy way of handling exceptions for all actions
*/
public function dispatch($action)
{
parent::dispatch($action);
return;
try {
parent::dispatch($action);
} catch (exception $e) {
ob_start();
var_export($e);
error_log(ob_get_clean());
}
}
示例4: dispatch
public function dispatch($action)
{
try {
parent::dispatch($action);
$this->addInfoMessages();
$this->addSuccessMessages();
} catch (Core_Exception_Validation $exc) {
$this->_persistDataError();
$this->addErrorMessages();
$this->addAlertMessages();
$this->getMessaging()->dispatchPackets();
$this->_dispatchException($action, $exc);
} catch (Core_Exception_Verification $exc) {
$this->_persistDataError();
$this->addErrorMessages();
$this->addAlertMessages();
$this->getMessaging()->dispatchPackets();
$this->_dispatchException($action, $exc);
} catch (Core_Exception $exc) {
throw $exc;
} catch (Exception $exc) {
throw $exc;
}
}
示例5: dispatch
public function dispatch($action)
{
if (Zend_Registry::get('requestIsAjax')) {
$this->_helper->layout->disableLayout();
}
parent::dispatch($action);
}
示例6: dispatch
/**
* Dispatch the requested action
*
* @param string $action Method name of action
* @return void
*/
public function dispatch($action)
{
try {
parent::dispatch($action);
} catch (Exception $e) {
$cachePage = $this->getInvokeArg('bootstrap')->getResource('cachemanager')->getCache('_page');
if (null !== $cachePage && method_exists($cachePage, 'cancel')) {
$cachePage->cancel();
}
$cachePage = $this->getInvokeArg('bootstrap')->getResource('cachemanager')->getCache('page');
if (null !== $cachePage && method_exists($cachePage, 'cancel')) {
$cachePage->cancel();
}
throw $e;
}
}
示例7: dispatch
/**
* Dispatch the requested action
*
* @param string $action Method name of action
* @return void
*/
public function dispatch($action)
{
$dbAdapter = Zend_Registry::getInstance()->dbAdapter;
try {
parent::dispatch($action);
} catch (Exception $e) {
$this->getLogger()->err($e->getMessage() . $e->getTraceAsString());
}
}
示例8: dispatch
/**
* (non-PHPdoc)
* @see Zend_Controller_Action::dispatch()
*/
public function dispatch($action)
{
$action = substr($action, 0, -6);
$format = '';
for ($i = strlen($action) - 1; $i >= 0; $i--) {
$format = $action[$i] . $format;
$code = ord($action[$i]);
if ($code >= 65 && $code <= 90) {
break;
}
}
$format = strtolower($format);
if (in_array($format, $this->_responseFormats)) {
$action = substr($action, 0, -1 * strlen($format));
} else {
$format = 'json';
}
$this->_setParam('responseformat', $format);
parent::dispatch($action . 'Action');
}
示例9: dispatch
public function dispatch($action)
{
try {
parent::dispatch($action);
} catch (Exception $ex) {
return;
}
$this->view->currentAction = $action;
$this->view->cssLinks = $this->_cssLinks;
$this->view->jsLinks = $this->_jsLinks;
}
示例10: dispatch
/**
* Dispatches the action with the given name:
*
* Example:
*
* $this->dispatch('my-action');
*
* @param string $action
*/
protected function dispatch($action)
{
$this->request->setActionName($action);
$this->controller->dispatch($this->actionNameToMethod($action));
}