Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added createExceptionMapper() method to overwrite them and add custom…

… parameters by overwriting getParameters() method.
  • Loading branch information...
commit 7a902cea023baa2c294219d6c44f0eff5d757c09 1 parent ee9216b
@pschirch pschirch authored
Showing with 18 additions and 2 deletions.
  1. +18 −2 Controller/ExceptionController.php
View
20 Controller/ExceptionController.php
@@ -29,6 +29,19 @@
class ExceptionController extends ContainerAware
{
/**
+ * Creates a new ExceptionWrapper instance that can be overwritten by a custom
+ * ExceptionController class.
+ *
+ * @param array $parameters Template parameters
+ *
+ * @return ExceptionWrapper ExceptionWrapper instance
+ */
+ protected function createExceptionWrapper(array $parameters)
+ {
+ return new ExceptionWrapper($parameters);
+ }
+
+ /**
* Converts an Exception to a Response.
*
* @param Request $request Request
@@ -55,7 +68,7 @@ public function showAction(Request $request, FlattenException $exception, DebugL
try {
if (!$viewHandler->isFormatTemplating($format)) {
- $parameters = new ExceptionWrapper($parameters);
+ $parameters = $this->createExceptionWrapper($parameters);
}
$view = View::create($parameters, $code, $exception->getHeaders());
@@ -172,7 +185,10 @@ protected function getFormat(Request $request, $format)
}
/**
- * Determine the parameters to pass to the view layer
+ * Determine the parameters to pass to the view layer.
+ *
+ * Overwrite it in a custom ExceptionController class to add additionally parameters
+ * that should be passed to the view layer.
*
* @param ViewHandler $viewHandler The view handler instance
* @param string $currentContent The current content in the output buffer
Please sign in to comment.
Something went wrong with that request. Please try again.