سؤال

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();
  ...
}
هل كانت مفيدة؟

المحلول

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();
  ...
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top