Example #1
0
 /**
  * @internal
  */
 public function preDispatch()
 {
     $this->getResponse()->setHttpResponseCode(500);
     if (!($error = $this->getParam('error_handler'))) {
         return;
     }
     $code = $error->exception->getCode();
     $callback = Benri_Util_String::camelize($this->getResponse()->getMessageFromCode($code));
     $this->_pushError(null, $code, $error->exception->getMessage());
     if ($callback) {
         $this->getResponse()->setHttpResponseCode($code);
         if (method_exists($this, "{$callback}Action")) {
             return $this->getRequest()->setActionName($callback);
         }
     } else {
         switch ($error->type) {
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                 $this->getResponse()->setHttpResponseCode(404);
                 $this->getRequest()->setActionName('not-found');
                 break;
         }
     }
 }
Example #2
0
File: Row.php Project: douggr/benri
 /**
  * Set a row field value.
  *
  * @internal
  */
 public function __set($columnName, $value)
 {
     $setter = Benri_Util_String::camelize($columnName, true);
     if (method_exists($this, $setter = "set{$setter}")) {
         $value = call_user_func_array([$this, $setter], [$value]);
     }
     return parent::__set($columnName, $value);
 }