示例#1
0
文件: index.php 项目: im286er/Ding
 public function preHandle(Action $action, $handler)
 {
     $arguments = $action->getArguments();
     if (!isset($arguments['optional'])) {
         return new RedirectModelAndView('http://github.com/marcelog/Ding');
     }
     return true;
 }
示例#2
0
 /**
  * This will map an exception action to a controller. Will look for
  * an instance of the mapped exception to the thrown exception.
  *
  * @param Action $action Original action (exception).
  *
  * @return array [0] => Controller [1] => Method to call (With
  * 'Exception' appended to the end of the method name).
  */
 public function map(Action $action)
 {
     $exception = $action->getArguments();
     $exception = $exception['exception'];
     $this->_logger->debug('Exception mapper invoked with: ' . $action->getId());
     // Lookup a controller that can handle this url.
     foreach ($this->_map as $map) {
         $controllerException = $map[0];
         $controller = $map[1];
         if (!$exception instanceof $controllerException) {
             continue;
         }
         return new DispatchInfo($action, $controller, str_replace('\\', '_', $controllerException) . 'Exception');
     }
     return false;
 }