This seems to be the dumbest question, but I can't figure it out. I have a page that needs to be redirected to a complex route, and I cannot create a URL. Redirecting to a simple route is quite simple:
return $this->redirect($this->generateUrl('testnumber'));
However, I want to go to: testnumber / 1 / question / 4. How can I accomplish this incredibly simple task? The only thing I found in the documentation, and Google allows me to add parameters, and not just create complex routes. For instance:
generateURL('testnumber', array('testid'=>1, 'question'=>4))
does url / testnumber? testid = 1 & question = 4, which I don't want.
Edit: Yes, I already have the route created in the YML file. I just can't create a URL to link to it.
return $this->redirect($this->generateUrl(???????????),true));
This is my route:
@Route("/testnumber/{testid}/question/{question}", name="testnumber")
The symfony documentation only shows how to create a url for "testnumber / 1", I need to create "testnumber / 1 / question / 4".
source share