本文整理汇总了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;
}
示例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;
}