Mick Segvezent
Mick Segvezent

Reputation: 117

Redirect with two parameter?

Why i can't make redirect with two parameter in Symfony 1.4?

$this->redirect('news/edit?id='.$news->getId() . '&test='.$news->getTest());

This redirect me to http://mysite.com/news/edit/id/3 instead of to:

http://mysite.com/news/edit/id/3/test/4

How can i make redirect with two parameter?

Upvotes: 1

Views: 184

Answers (2)

Del Pedro
Del Pedro

Reputation: 1213

redirect expecst a url, you can build this url with the url helper methods like

url_for2($routeName, $params = array());

where params is an associative array.

Upvotes: 1

binarious
binarious

Reputation: 4588

Your solution should work just fine.

But check if $news->getTest() isn't empty and check if you're not having a routing that makes problems.

Alternatively you can give this a try:

$this->getRequest()->setParameter('id', $news->getId());
$this->getRequest()->setParameter('test', $news->getTest());
$this->forward('news', 'edit');

Upvotes: 3

Related Questions