Question

I have trouble redirecting an object (or routing object) from an action to another action.

my actions file:

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();
  ...
}
Was it helpful?

Solution

Got it:

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();
  ...
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top