Controller/DispatchHelper.php
\Conjoon_Controller_DispatchHelper
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

dispatch(
)
:
voidCalls 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.

getCurrentExceptions(
\Zend_Controller_Response_Abstract $response
)
:
ArrayReturns all exceptions that have been registered to the specified response object.
| Name | Type | Description |
|---|---|---|
| $response | \Zend_Controller_Response_Abstract | The response object to check for exceptions |
| Type | Description |
|---|---|
| Array |

mergeExceptions(
Array $exceptions
)
:
ArrayMerges the specified exceptions into an array that is prepared based on the current context the request was dispatched in.
| Name | Type | Description |
|---|---|---|
| $exceptions | Array |
| Type | Description |
|---|---|
| Array |

transformExceptions(
Array $exceptions
=
array()
)
:
ArrayTransforms 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
| Name | Type | Description |
|---|---|---|
| $exceptions | Array |
| Type | Description |
|---|---|
| Array |