I'm using Symfony 1.4 and i want to forward in my controller to another controller and action with some parameters.
After creating a "bike" with "bike/create" i want to forward to "bike/show/id/X" with the id i got from my new bike instance.
$forwardString = 'bike/show/id/'.$开发者_StackOverflowbike->id;
$this->forward($url);
This does not work :-(
Maybe you can help! :) Greetings!
The method definition for forward
is public function forward($module, $action)
the request should be preserved and if theese are things not currently in the request you will have to add them first.
Also you might even need redirect
instead so the url changes and where you just give it the url public function redirect($url, $statusCode = 302)
so usage would be $this->redirect('bike/show?id=' . $bike->id);
精彩评论