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


PHP AbstractController::handleActionInternal方法代码示例

本文整理汇总了PHP中AbstractController::handleActionInternal方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractController::handleActionInternal方法的具体用法?PHP AbstractController::handleActionInternal怎么用?PHP AbstractController::handleActionInternal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AbstractController的用法示例。


在下文中一共展示了AbstractController::handleActionInternal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleActionInternal

 protected function handleActionInternal($method)
 {
     try {
         $this->Response->addHeader('Cache-Control', 'no-cache, must-revalidate, post-check=0, pre-check=0');
         $this->Response->addHeader('Expires', $this->DateFactory->newLocalDate()->toRFCDate());
         $handler = $this->RequestContext->getControls()->getControl('view_handler');
         switch ($handler) {
             case 'xml':
                 $this->Response->sendHeader('Content-Type', 'application/xml; charset="' . $this->charset . '"');
                 break;
             case 'json':
             default:
                 $this->Response->sendHeader('Content-Type', 'application/json; charset="' . $this->charset . '"');
                 break;
         }
         parent::handleActionInternal($method);
         if (!is_null($this->view) && !is_string($this->view->getName())) {
             throw new Exception('Method [' . $method . '] failed to return a valid view, was [' . $this->view->getName() . ']');
         }
     } catch (NonceException $ne) {
         $this->bindToActionDatasource(array());
         //if(LOG_ENABLE) System::log(self::$logType, 'Validation Exception: ['.print_r($ve, true).']');
         $this->errors->addGlobalError($ne->getCode(), 'The record you attempted to edit has expired. This is typically caused by keeping a page open for longer than 6 hours without any changes.');
         echo $this->errorsResponse();
         return null;
     } catch (ValidationException $ve) {
         $this->bindToActionDatasource(array());
         //if(LOG_ENABLE) System::log(self::$logType, 'Validation Exception: ['.print_r($ve, true).']');
         $this->errors->addErrors($ve->getErrors()->getErrors());
         echo $this->errorsResponse();
         return null;
     } catch (ActionException $ae) {
         $this->bindToActionDatasource(array());
         //if(LOG_ENABLE) System::log(self::$logType, 'Action Exception: ['.print_r($ae, true).']');
         // store error messages and error fields somewhere
         $this->errors->addGlobalError($ae->getCode(), $ae->getMessage());
         $view = $ae->getView() ? $ae->getView() : $this->formView();
         $data = $ae->getData();
         $this->view = new View($view, $data);
     } catch (Exception $e) {
         $this->ErrorHandler->sendErrorEmail($e);
         $this->errors->addGlobalError($e->getCode(), $e->getMessage())->throwOnError();
         echo $this->errorsResponse();
         return null;
     }
     return true;
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:47,代码来源:AbstractApiController.php

示例2: handleActionInternal

 protected function handleActionInternal($method)
 {
     try {
         parent::handleActionInternal($method);
         if (is_string($this->view)) {
             $this->view = new View($this->view);
         }
         if (!is_null($this->view) && !is_string($this->view->getName())) {
             throw new Exception('Method [' . $method . '] failed to return a valid view, was [' . $this->view->getName() . ']');
         }
     } catch (ValidationException $ve) {
         //if(LOG_ENABLE) System::log(self::$logType, 'Validation Exception: ['.print_r($ve, true).']');
         $this->errors->addErrors($ve->getErrors()->getErrors());
         $this->view = new View($this->formView());
     } catch (ActionException $ae) {
         //if(LOG_ENABLE) System::log(self::$logType, 'Action Exception: ['.print_r($ae, true).']');
         // store error messages and error fields somewhere
         $this->errors->addGlobalError($ae->getCode(), $ae->getMessage());
         $view = $ae->getView() ? $ae->getView() : $this->formView();
         $data = $ae->getData();
         $this->view = new View($view, $data);
     }
     return true;
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:24,代码来源:AbstractWebController.php


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