Controller/DispatchHelper.php

Show: inherited
Table of Contents

\Conjoon_Controller_DispatchHelper

Package: Conjoon\Controller

The DispatchHelper's main purpose is to catch any exception that was thrown by the FrontController directly and transform this exception (along with any other exceptions that were found in the front controller's current response to Json data.

It does also provide convinient methods for merging exceptions for the Ext.Direct-API, based on the availability of the ExtRequest-Plugin. ErrorControllers are advised to utilize the "transformExceptions" method to apply a proper json datastructure for the client.

Author
Thorsten Suckow-Homberg  

Methods

methodprivate__clone( ) : void

methodprivate__construct( ) : void

Constructor.

Private to enforce static behavior.

methodpublicdispatch( ) : void
static

Calls front controller's dispatch method and intercepts any exception thrown if front contoller's throwExceptions was set to true.

Exception will be passed to _getExceptionResponse which will return an array of exceptions that have to be returned to the client. This method will json-encode those exceptions and based on the current context (extRequest yes? no?) send those exceptions properly back to the client. Script processing will be stopped if an exception has been caught so no further proccesing of any logic will be possible afterwards.

methodpublicgetCurrentExceptions( \Zend_Controller_Response_Abstract $response ) : Array
static

Returns all exceptions that have been registered to the specified response object.

Parameters
Name Type Description
$response \Zend_Controller_Response_Abstract

The response object to check for exceptions

Returns
Type Description
Array
methodpublicmergeExceptions( Array $exceptions ) : Array
static

Merges the specified exceptions into an array that is prepared based on the current context the request was dispatched in.

Parameters
Name Type Description
$exceptions Array
Returns
Type Description
Array
methodpublictransformExceptions( Array $exceptions = array() ) : Array
static

Transforms an array of exceptions to an array that can be easily handled by the frontend.

The following keys are available:

success: always set to false error : either an array of Conjoon_ErrorDto's, or a single object of the type Conjoon_ErrorDto

Parameters
Name Type Description
$exceptions Array
Returns
Type Description
Array
Documentation was generated by DocBlox 0.18.1.