This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Fabien Potencier 21d7b63ee8 merged branch Crell/redirect-set-target (PR #5081)
Commits
-------

76815fe Allow the targetUrl on a redirect response to be set explicilty.

Discussion
----------

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... :-)

---------------------------------------------------------------------------

by vicb at 2012-07-27T15:45:47Z

> 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.

You can not change the target URL, but you can create a new `RedirectResponse` to override the original one (by calling `$event->setResponse()` in the listener).
2012-07-28 08:21:01 +02:00
src/Symfony Allow the targetUrl on a redirect response to be set explicilty. 2012-07-27 09:40:11 -05:00
.editorconfig Add EditorConfig File 2012-06-16 14:08:15 +02:00
.gitignore ignore composer.phar 2012-04-20 14:10:06 +01:00
.travis.yml Revert "merged branch stof/travis_version (PR #4905)" 2012-07-15 12:13:31 +02:00
autoload.php.dist removed unneeded code 2012-06-30 16:47:41 +02:00
CHANGELOG-2.0.md updated CHANGELOG for 2.0.14 2012-05-17 18:29:55 +02:00
composer.json [Form] Improved FormRenderer API to reduce the size of the function call stack during rendering 2012-07-22 09:29:35 +02:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.0.14 2012-05-17 18:30:22 +02:00
LICENSE Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
phpunit.xml.dist Set init.default_locale to 'en' in phpunit.xml.dist 2012-05-11 09:33:42 +02:00
README.md added some warnings about known PHP bugs 2012-07-15 12:19:52 +02:00
UPGRADE-2.1.md [FrameworkBundle] Switched to parameters for request context host and scheme 2012-07-26 11:12:14 +02:00

README

Build Status

What is Symfony2?

Symfony2 is a PHP 5.3 full-stack web framework. It is written with speed and flexibility in mind. It allows developers to build better and easy to maintain websites with PHP.

Symfony can be used to develop all kind of websites, from your personal blog to high traffic ones like Dailymotion or Yahoo! Answers.

Requirements

Symfony2 is only supported on PHP 5.3.3 and up.

Be warned that PHP versions before 5.3.8 are known to be buggy and might not work for you:

Installation

The best way to install Symfony2 is to download the Symfony Standard Edition available at http://symfony.com/download.

Documentation

The "Quick Tour" tutorial gives you a first feeling of the framework. If, like us, you think that Symfony2 can help speed up your development and take the quality of your work to the next level, read the official Symfony2 documentation.

Contributing

Symfony2 is an open source, community-driven project. If you'd like to contribute, please read the Contributing Code part of the documentation. If you're submitting a pull request, please follow the guidelines in the Submitting a Patch section.