Skip to content

Instantly share code, notes, and snippets.

@ronan-gloo
Created July 24, 2013 15:41
Show Gist options
  • Save ronan-gloo/6071752 to your computer and use it in GitHub Desktop.
Save ronan-gloo/6071752 to your computer and use it in GitHub Desktop.
Gestion 404 dans les controleurs
<?php
// Remplacer:
if (!$page) {
$response = new Response();
$response->setStatusCode(404);
return $response;
}
// Par:
if (!$page) {
$this->getResponse()->setStatusCode(404);
return false;
}
// Sinon le 404 n'est pas catché par le dispatch listener.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment