Merge remote branch 'weaverryan/controller_redirect'

This commit is contained in:
Fabien Potencier 2011-03-22 16:10:56 +01:00
commit b0cee4527a

View File

@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Controller; namespace Symfony\Bundle\FrameworkBundle\Controller;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\DependencyInjection\ContainerAware; use Symfony\Component\DependencyInjection\ContainerAware;
/** /**
@ -51,6 +52,19 @@ class Controller extends ContainerAware
return $this->container->get('http_kernel')->forward($controller, $path, $query); return $this->container->get('http_kernel')->forward($controller, $path, $query);
} }
/**
* Returns a RedirectResponse to the given URL.
*
* @param string $url The URL to redirect to
* @param integer $status The status code to use for the Response
*
* @return RedirectResponse
*/
public function redirect($url, $status = 302)
{
return new RedirectResponse($url, $status);
}
/** /**
* Returns a rendered view. * Returns a rendered view.
* *