I find it perverse that we need to modify the request to hold data for within the request. It would be great if the lifecycle of the $this->setVar() was the request and was shared between all the components, actions and templates.
Putting it in flash also seems workable but then it pollutes the next request. Balaji On Jan 19, 2008, at 10:02 AM, Fabian Lange wrote: > > Use Request or Flash Parameter Holder for that > .: Fabian > > -----Original Message----- > From: > [EMAIL PROTECTED] > om > [mailto:[EMAIL PROTECTED] > groups.com] On Behalf Of Balaji Srinivasan > Sent: Samstag, 19. Januar 2008 18:47 > To: [email protected] > Subject: [symfony-users] Re: Sharing data between actions and > components > > > Thanks Lee. > This is what I mean. > > I have a page with a main part and a side bar. > When the action method is called (say its executeDoStuff() I do the > following: > > public function executeDoStuff() { > $id = $this->getRequestParameter('id'); > $data = DataPeer::retrieveByPK($id); > $this->setVar('data', $data); > return sfView::SUCCESS; > } > > Now the template doStuff.php can use the data. Later when the sidebar > component gets called I need to be able to access the retrieved data > above. > > public function executeSidebar() { > $data = $this->getVar('data'); > // do stuff > return sfView::SUCCESS; > } > > The reason the two things are split as components (instead of just > partials) is that I need to do some processing on the data before > rendering the sidebar. > Any suggestions? > Thanks > Balaji > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
