Merge remote branch 'weaverryan/controller_not_found_exception'
* weaverryan/controller_not_found_exception: [FrameworkBundle] Adding a shortcut method to the controller for throwing the NotFoundHttpException
This commit is contained in:
commit
9162e4c760
@ -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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user