PHP Class Symfony\Bundle\FrameworkBundle\Controller\RedirectController

Author: Fabien Potencier ([email protected])
Inheritance: extends Symfony\Component\DependencyInjection\ContainerAware
Show file Open project: pmjones/php-framework-benchmarks Class Usage Examples

Public Methods

Method Description
redirectAction ( string $route, boolean $permanent = false ) : Response Redirects to another route.
urlRedirectAction ( string $path, boolean $permanent = false, boolean $scheme = null, integer $httpPort = 80, integer $httpsPort = 443 ) : Response Redirects to a URL.

Method Details

redirectAction() public method

It expects a route path parameter. By default, the response status code is 301. If the route empty, the status code will be 410. If the permanent path parameter is set, the status code will be 302.
public redirectAction ( string $route, boolean $permanent = false ) : Response
$route string The route pattern to redirect to
$permanent boolean Whether the redirect is permanent or not
return Symfony\Component\HttpFoundation\Response A Response instance

urlRedirectAction() public method

By default, the response status code is 301. If the path is empty, the status code will be 410. If the permanent flag is set, the status code will be 302.
public urlRedirectAction ( string $path, boolean $permanent = false, boolean $scheme = null, integer $httpPort = 80, integer $httpsPort = 443 ) : Response
$path string The path to redirect to
$permanent boolean Whether the redirect is permanent or not
$scheme boolean The URL scheme (null to keep the current one)
$httpPort integer The HTTP port
$httpsPort integer The HTTPS port
return Symfony\Component\HttpFoundation\Response A Response instance