Flash messages after redirection
Hi.
In my app, after a user changes his password, I redirect him to his profile form page. Doing so, the flash message with the password change success is getting eaten in the way, as it does not show.
How do you perform the redirect?
I use a listener for the CHANGE_PASSWORD_SUCCESS event setting the response with a RedirectResponse for the profile route.
I found out that the flashes get lost after
$result = $this->controller->editAction($this->getRequest());
in the edit method of the Profile Manager.
My workaround is saving the existing flashes before that call:
$flashes = $this->getRequest()->getSession()->getFlashBag()->all();
and then setting them back afterwards with
$this->getRequest()->getSession()->getFlashBag()->setAll($flashes);