Symfony\Bundle\FrameworkBundle\Controller\Controller::createNotFoundException PHP Method

createNotFoundException() protected method

This will result in a 404 response code. Usage example: throw $this->createNotFoundException('Page not found!');
protected createNotFoundException ( string $message = 'Not Found', Exception $previous = null ) : NotFoundHttpException
$message string A message
$previous Exception The previous exception
return Symfony\Component\HttpKernel\Exception\NotFoundHttpException
    protected function createNotFoundException($message = 'Not Found', \Exception $previous = null)
    {
        return new NotFoundHttpException($message, $previous);
    }

Usage Example

 public function testCreateNotFoundException()
 {
     $controller = new Controller();
     $this->assertInstanceOf('Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException', $controller->createNotFoundException());
 }
All Usage Examples Of Symfony\Bundle\FrameworkBundle\Controller\Controller::createNotFoundException