|
@@ -14,6 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\Controller;
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
|
|
use Symfony\Component\DependencyInjection\ContainerAware;
|
|
|
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|
|
|
|
|
/**
|
|
|
* Controller is a simple implementation of a Controller.
|
|
@@ -92,6 +93,20 @@ class Controller extends ContainerAware
|
|
|
return $this->container->get('templating')->renderResponse($view, $parameters, $response);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Returns a NotFoundHttpException.
|
|
|
+ *
|
|
|
+ * This will result in a 404 response code. Usage example:
|
|
|
+ *
|
|
|
+ * throw $this->createNotFoundException('Page not found!');
|
|
|
+ *
|
|
|
+ * @return NotFoundHttpException
|
|
|
+ */
|
|
|
+ public function createNotFoundException($message = 'Not Found', \Exception $previous = null)
|
|
|
+ {
|
|
|
+ return new NotFoundHttpException($message, $previous);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Returns true if the service id is defined.
|
|
|
*
|