I
I
Ivan Kondratiev2015-10-18 15:33:49
symfony
Ivan Kondratiev, 2015-10-18 15:33:49

How to properly redirect to the previous page in symfony2?

The point is this. There is an action for deleting (for example, books from a database). After deletion, you need to redirect to the page where you clicked the delete button. There may be several pages with such buttons. Is there a way to get the route name of the previous page and use $this->redirectToRoute() ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Skobkin, 2015-10-18
@inik23

Perhaps somehow you can get the name of the route of the previous page

It is possible to get the referrer of the previous page.
In the case of the referrer, you will not need this method, but $this->redirect().
Although, for example, here there is a somewhat crutch alternative .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question