/** * Class constructor * * The request and response objects should be registered with the * controller, as should be any additional optional arguments; these will be * available via {@link getRequest()}, {@link getResponse()}, and * {@link getInvokeArgs()}, respectively. * * When overriding the constructor, please consider this usage as a best * practice and ensure that each is registered appropriately; the easiest * way to do so is to simply call parent::__construct($request, $response, * $invokeArgs). * * After the request, response, and invokeArgs are set, the * {@link $_helper helper broker} is initialized. * * Finally, {@link init()} is called as the final action of * instantiation, and may be safely overridden to perform initialization * tasks; as a general rule, override {@link init()} instead of the * constructor to customize an action controller's instantiation. * * @param Zend_Controller_Request_Abstract $request * @param Zend_Controller_Response_Abstract $response * @param array $invokeArgs Any additional invocation arguments * @return void */ public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array()) { // Set error $error = $request->getParam(Zym_Controller_Plugin_ErrorHandler::ERROR_PARAM); if ($error instanceof Zym_Controller_Plugin_ErrorHandler_Data) { $this->setError($error); } // Setup default fallback $defaultModule = $this->getFrontController()->getDefaultModule(); $this->setFallBack('error', 'error', $defaultModule); // Call Parent parent::__construct($request, $response, $invokeArgs); }
/** * Class constructor * * The request and response objects should be registered with the * controller, as should be any additional optional arguments; these will be * available via {@link getRequest()}, {@link getResponse()}, and * {@link getInvokeArgs()}, respectively. * * When overriding the constructor, please consider this usage as a best * practice and ensure that each is registered appropriately; the easiest * way to do so is to simply call parent::__construct($request, $response, * $invokeArgs). * * After the request, response, and invokeArgs are set, the * {@link $_helper helper broker} is initialized. * * Finally, {@link init()} is called as the final action of * instantiation, and may be safely overridden to perform initialization * tasks; as a general rule, override {@link init()} instead of the * constructor to customize an action controller's instantiation. * * @param Zend_Controller_Request_Abstract $request * @param Zend_Controller_Response_Abstract $response * @param array $invokeArgs Any additional invocation arguments * @return void */ public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array()) { // Set error $error = $request->getParam(Zym_Controller_Plugin_ErrorHandler::ERROR_PARAM); if ($error instanceof Zym_Controller_Plugin_ErrorHandler_Data) { $this->setError($error); } // Setup default fallback $defaultModule = $this->getFrontController()->getDefaultModule(); $this->setFallBack('error', 'error', $defaultModule); // Error Handling map $this->setErrorHandlers(array( Zym_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER => array( self::ACTION => 'not-found', self::CONTROLLER => 'error', self::MODULE => $defaultModule ), Zym_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION => array( self::ACTION => 'not-found', self::CONTROLLER => 'error', self::MODULE => $defaultModule ), Zym_Controller_Plugin_ErrorHandler::EXCEPTION_OTHER => array( self::ACTION => 'internal', self::CONTROLLER => 'error', self::MODULE => $defaultModule ) )); // Call Parent parent::__construct($request, $response, $invokeArgs); }