KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm having a small problem when trying to flash a message and redirect the user back to the previous page in Symfony 2 . I have a very simple CRUD. When new, or edit, i want to flash a message if something goes wrong in the respective create/update methods: User --GET--> new new --POST--> create (fails) --REDIRECT--> new (with flash message) I'm doing the following: $this->container->get('session')->setFlash('error', 'myerror'); $referer = $this->getRequest()->headers->get('referer'); return new RedirectResponse($referer); However, it's not redirecting to the correct referrer! Even though the value of referrer is correct (eg.: http://localhost/demo/2/edit/ ) It redirects to the index. Why?
Tags (comma-separated)
Save Edits
Cancel