Create 404 Error in Symfony 2.0

Author: Mic Johnson
Last Edited: 05/02/2012
Category: Symfony2.0

Tags: symfony 2.0,symfony,404,error,404 error,redirecting,createnotfoundexception,notfound

Here is an example of how to forward someone to a 404 error page in Symfony 2.0.

How to create a 404 Error

Inside of the controller include:

throw $this->createNotFoundException('That id does not exist!');