Example #1
0
 /**
  * Dispatch.
  * Override it to use own logic.
  *
  * @throws \Exception
  * @return object
  */
 public function dispatch()
 {
     try {
         $parts = explode('_', $this->_handlerName);
         $finalHandlerName = '';
         foreach ($parts as $part) {
             $finalHandlerName .= ucfirst($part);
         }
         $this->_handlerName = $finalHandlerName;
         $this->_actionName = strtolower($this->_actionName);
         return parent::dispatch();
     } catch (\Exception $e) {
         $this->_handleException($e);
         if (ENV == ENV_DEVELOPMENT) {
             throw $e;
         } else {
             $id = Exception::logError('Exception', $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
             $this->getDI()->setShared('currentErrorCode', function () use($id) {
                 return $id;
             });
         }
     }
     return parent::dispatch();
 }