0

我无法将对象(或路由对象)从一个动作重定向到另一个动作。

我的动作文件:

protected function example(...){
  ...
  $object = Doctrine::getTable('object')->findOneById(1); //for example
  ...
  //dunno how to pass $object to executeShow 
  $url = $this->generateUrl('object_show', array('sf_subject' => $object));
  $this->redirect($url);

public function executeShow(sfWebRequest $request){
  $this->object = $this->getRoute()->getObject();
  ...
}
4

1 回答 1

2

知道了:

protected function example(...){
  ...
  $object = Doctrine::getTable('object')->findOneById(1); //for example
  ...
  //this worked :)
  $this->getRequest()->setParameter('sf_subject', $object);
  $this->forward('module', 'show');
}
public function executeShow(sfWebRequest $request){
  $this->object = $this->getRoute()->getObject();
  ...
}
于 2013-11-14T14:27:39.603 回答