1

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?

1
  • 2
    it works for me this way :S maybe this have something to do with your routing system Commented Apr 25, 2012 at 13:18

2 Answers 2

3

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');
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.