so i’m looking for a way to simulate an 404 error, i tried this :
throw $this->createNotFoundException();
and this
return new Response("",404);
but none does work.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can find the solution in the Symfony2 documentation:
http://symfony.com/doc/2.0/book/controller.html
Managing Errors and 404 Pages
There is a short information in the documentation:
“The createNotFoundException() method creates a special NotFoundHttpException object, which ultimately triggers a 404 HTTP response inside Symfony.”
In my scripts i’ve made it like this: