symfony redirect with 2 parameters

kipelovets picture kipelovets · Sep 30, 2009 · Viewed 90.8k times · Source

how can i redirect to another action passing 2 or more parameters? this code:

$this->redirect('input/new?year=' . $year . '&month=' . $month);

results in URL:

http://.../input?year=2009&month=9

Answer

xarch picture xarch · Sep 30, 2009

Well, that's normal, "redirect" redirect to an absolute URL. You can do that:

$this->redirect($this->generateUrl('default', array('module' => 'input',
'action' => 'new', 'year' => $year, 'month' => $month)));