Skip to content

Commit

Permalink
Updating some code that was correct in the script, but had gotten los…
Browse files Browse the repository at this point in the history
…t in the finish product of the code
  • Loading branch information
weaverryan committed Sep 23, 2013
1 parent 2f960a3 commit 3e0cdb9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion finish/app/config/config.yml
Expand Up @@ -4,6 +4,11 @@ imports:
- { resource: "@EventBundle/Resources/config/services.yml" }
- { resource: "@UserBundle/Resources/config/services.yml" }

services:
yoda_event.controller.exception_controller:
parent: twig.controller.exception
class: Yoda\EventBundle\Controller\ExceptionController

framework:
#esi: ~
translator: { fallback: %locale% }
Expand All @@ -24,7 +29,7 @@ framework:
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%
exception_controller: "EventBundle:Exception:show"
exception_controller: "yoda_event.controller.exception_controller:showAction"

# Assetic Configuration
assetic:
Expand Down
Expand Up @@ -4,26 +4,27 @@

use Symfony\Bundle\TwigBundle\Controller\ExceptionController as BaseController;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;

class ExceptionController extends BaseController
{
private $exceptionClass;

public function showAction(FlattenException $exception, DebugLoggerInterface $logger = null, $format = 'html')
public function showAction(Request $request, FlattenException $exception, DebugLoggerInterface $logger = null, $format = 'html')
{
$this->exceptionClass = $exception->getClass();

return parent::showAction($exception, $logger, $format);
return parent::showAction($request, $exception, $logger, $format);
}

protected function findTemplate($templating, $format, $code, $debug)
protected function findTemplate(Request $request, $format, $code, $debug)
{
if (!$debug && $this->exceptionClass == 'Yoda\EventBundle\Exception\EventNotFoundException') {
return 'EventBundle:Exception:error404.html.twig';
}

return parent::findTemplate($templating, $format, $code, $debug);
return parent::findTemplate($request, $format, $code, $debug);
}


Expand Down

0 comments on commit 3e0cdb9

Please sign in to comment.