symfony/symfony — Issue #2517: Allow an embedded controller to redirect.
Author: Kasheen
Created: 2011-10-30 13:36:15+00:00
State: open

Would it be feasible to add functionality to allow an embedded controller to redirect?

The use case is to allow a form to be re-used on multiple pages (such as a comment form for different entities, or a search form) but still be able to do the get-post-redirect flow. The idea is to have the embedded controller handle the form without having to write a form handler and call it from every parent controller that uses the form, all that is required is the render tag meaning the form could be completely decoupled.

Currently attempting to return a redirect response from an embedded controller results in an exception stemming from:

Symfony/Bundle/FrameworkBundle/HttpKernel.php at line 140

into

twig/lib/Twig/Template.php at line 182

More information can be found on Stack Overflow:

http://stackoverflow.com/questions/6984429/redirect-from-embedded-controller
http://stackoverflow.com/questions/6997128/how-to-handle-forms-that-are-used-on-multiple-pages

Thanks for your time and feedback!