I use embedded controller to render form that’s used on multiple pages:
Twig
{% render 'Bundle:Controller:someForm' %}
Controller
public function someFormAction()
{
// Some logic
...
if ($form->isValid()) {
...
$this->get('session')->setFlash('successful', "Woey!");
return $this->redirect($this->generateUrl('homepage'));
}
return $this->render('Bundle:Template:form.html.twig', array('form' => $form->createView()));
}
I need to redirect back to homepage after the form was successfully submitted as a part of post-redirect-get design pattern. If I use it as I described above, I’ll get exception as response from embedded controller was 302 instead of 200 (at least I expect it works like this).
Is it possible to redirect normally in such scenario? Or am I approaching the situation (with form that’s rendered on multiple pages) from totally wrong angle?
Just to make it official answer, Fabien doesn’t think Symfony2 will ever support this feature.