当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Controller_Action::dispatch方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:lordmx,项目名称:currency_parser,代码行数:37,代码来源:Base.php

示例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;
     }
 }
开发者ID:nyeholt,项目名称:relapse,代码行数:22,代码来源:NovemberController.php

示例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());
     }
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:15,代码来源:ITechController.php

示例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;
     }
 }
开发者ID:sgdoc,项目名称:sgdoce-codigo,代码行数:24,代码来源:Abstract.php

示例5: dispatch

 public function dispatch($action)
 {
     if (Zend_Registry::get('requestIsAjax')) {
         $this->_helper->layout->disableLayout();
     }
     parent::dispatch($action);
 }
开发者ID:jthurteau,项目名称:saf,代码行数:7,代码来源:Zend.php

示例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;
     }
 }
开发者ID:netconstructor,项目名称:Centurion,代码行数:22,代码来源:Action.php

示例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());
     }
 }
开发者ID:Velrok,项目名称:wg-organizer,代码行数:15,代码来源:ApplicationController.php

示例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');
 }
开发者ID:bjtenao,项目名称:tudu-web,代码行数:24,代码来源:OpenApi.php

示例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;
 }
开发者ID:utcuong3010,项目名称:vng,代码行数:11,代码来源:ViewpointchangelogController.php

示例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));
 }
开发者ID:matthimatiker,项目名称:molcomponents,代码行数:14,代码来源:WebControllerTestCase.php


注:本文中的Zend_Controller_Action::dispatch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。