Symfony : RedirectToRoute or GenerateUrl

853 Views Asked by At

All in subject ^^

What's the best for redirect :

RedirectToRoute('my_route', [my_params]);

or

RedirectResponse($this->generateUrl('my_route', [my_params]);

and why ?

I did not find a good answer in doc

1

There are 1 best solutions below

0
On BEST ANSWER

It is exactly the same.

The first is only meant to be easier to use ...

See this note :

http://symfony.com/blog/new-in-symfony-2-6-new-shortcut-methods-for-controllers