symfony/symfony — pull request #5081 by Crell (2012-07-27 15:03:28+00:00)
Title: Allow the targetUrl on a redirect response to be set explicilty.

Currently, RedirectResponse gets a Url set only when it's created, in the constructor. There is no way to change it later. That's a problem, because then you cannot change that Url from, say, a Kernel.response event listener. That's a use case that Drupal in particular needs, because on redirects we allow modules to change the redirect target. We also allow for redirect overrides via a GET parameter.

This PR refactors RedirectResponse to allow for a setTargetUrl() method. It gets called from the constructor now, and can also be called from wherever. It does not deal with changing the status code, just the Url (and by implication the content body).

Hopefully I got the coding style right this time... :-)