👁 查看:sfOpenPNEExecutionFilter.class.php
路径:/virtual/bigbrother/sns/lib/filter/sfOpenPNEExecutionFilter.class.php
大小:1.52 KB · 修改:2010-08-10 13:59:42 · 权限:0644 · 可写
<?php
/**
* This file is part of the OpenPNE package.
* (c) OpenPNE Project (http://www.openpne.jp/)
*
* For the full copyright and license information, please view the LICENSE
* file and the NOTICE file that were distributed with this source code.
*/
/**
* sfOpenPNEExecutionFilter
*
* @package OpenPNE
* @subpackage filter
* @author Kousuke Ebihara <ebihara@tejimaya.com>
*/
class sfOpenPNEExecutionFilter extends sfExecutionFilter
{
protected function handleAction($filterChain, $actionInstance)
{
$moduleName = $actionInstance->getModuleName();
$actionName = $actionInstance->getActionName();
$dispatcher = sfContext::getInstance()->getEventDispatcher();
$dispatcher->notify(new sfEvent($this, 'op_action.pre_execute_'.$moduleName.'_'.$actionName, array(
'moduleName' => $moduleName,
'actionName' => $actionName,
'actionInstance' => $actionInstance,
)));
try
{
$result = parent::handleAction($filterChain, $actionInstance);
}
catch (opRuntimeException $e)
{
$this->forwardToErrorAction();
}
$dispatcher->notify(new sfEvent($this, 'op_action.post_execute_'.$moduleName.'_'.$actionName, array(
'moduleName' => $moduleName,
'actionName' => $actionName,
'actionInstance' => $actionInstance,
'result' => $result,
)));
return $result;
}
protected function forwardToErrorAction()
{
$this->context->getController()->forward('default', 'error');
throw new sfStopException();
}
}