Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Controller] Convenience method redirectToCurrentRoute() #44485

Closed
@ThomasLandauer

Description

@ThomasLandauer

Description

What's the best practice for redirecting to the current route (e.g. when following the Post/Redirect/Get pattern)? I'm using

return $this->redirectToRoute($request->get('_route'));

...but since #42392, Request::get() is marked @internal.

So what about a new convenience method AbstractController::redirectToCurrentRoute(int $status = 302/303)?

Or am I missing something and there is another (better) way already? => Then it should be mentioned in https://symfony.com/index.php/doc/current/controller.html#redirecting

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions