symfony2 Routing POST request redirect


Example

When you are in a controllerAction And have a POST request coming in, but want to redirect it, to a different route, while still maintaining the POST method and the request object, you can use the following:

return $this->redirectToRoute('route', array(
    'request' => $request,
), 307);

Code 307 here preserves the request method.