'redirectToRoute' with query parameters - Symfony2


I have a /curso/{slug} route that does a 301 redirect to another route. This /curso/{slug} route can receive some parameters per query (example: /curso/{slug}?query=1234 ), but when redirect to the other route using return $this->redirectToRoute('nova_rota', array('slug' => $slug) , these query parameters are lost. How can I do to add the query parameters in this redirect.

Code block that redirects to the other route:

     * @Route("/{slug}", name="course_show")
    public function showAction(Request $request, $slug)

        return $this->redirectToRoute('redirect_slug', array('slug' => $slug));
asked by anonymous 21.09.2018 / 16:11

0 answers