Hello Anja, if I ever call requestAction then I do it in the approach, that Gwoo has mentioned in the cakery with caching turned on for the individual element.
But otherwise I would first look at your models. If hotelmasterinfo is somehow related to your current hotelinfo model, then you could just call a model function from hotemasterinfo. Otherwise it could make sense to include the hotelmasterinfo with $uses in your hotelinfo controller and then you could also call the hotelmasterinfo model function, that returns your data with just a call to the other model funtion. Siegfried On Thu, Oct 9, 2008 at 8:17 AM, Liebermann, Anja Carolin <[EMAIL PROTECTED]> wrote: > > Hello, > > I have read the article by Mark Story: > http://mark-story.com/posts/view/reducing-requestaction-use-in-your-cakephp-sites-with-fat-models > > So now I want to use that. In some cases it works already very fine, but I am > not sure if I can place an method in my model (which ist growing fatter day > by day *g*) when it calls information from another model. (I use Cakephp 1.2 > RC3) > > E.g.: > > My Model Hotelinfo belongsTo Hotel and Hotelinfomaster. > > Now in my controller hotels_controller.php I have a function where when a > hotel is added also a connected table entry of hotelinfo is added by getting > the data from the Hotelinfomaster. > > At the moment I do it this way: > $this->data = > $this->Hotel->requestAction('hotelinfos/add/'.$hotelmaster_id.'/'.$this->Hotel->id); > > That calls this funtion in hotelinfos_controller.php: > function add($hotelmaster_id = null, $hotel_id = null) { > if ($hotelmaster_id != null) { > $this->Hotelinfo->create(); > //get data from Masterobject 'Hotelinfomaster' > $this->data = > $this->Hotelinfo->requestAction('hotelinfomasters/getHotelinfomaster/'.$hotelmaster_id); > //do some data processing magic > if ($this->Hotelinfo->save($this->data['Hotelinfo'])) { > /*$this->Session->setFlash(__('The Hotelinfo wurde gespeichert', true)); > $this->redirect(array('action'=>'../hotels/edit/'.$hotelmaster_id));*/ > } else { > $this->Session->setFlash(__('The Hotelinfo konnte nicht gespeichert > werden. Bitte überprüfen Sie die Angaben.', true)); > } > } > } > > As you can see my function gets data from another model 'Hotelinfomaster'. > Can I place such a function in my model hoteilinfo.php? If yes what would be > the syntax to get the data from Hotelinfomaster? > > Thank you > > Anja > > > > -- Siegfried Hirsch hhS - Welserstr. 1 - 81373 München - (089) 5484 3564 - skype:shirsch Fax +49 - (0)89 - 943 992 698 - http://www.rss-blogger.de http://www.newsbee.de NewsBee 2 - customized RSS solutions http://abo-stop.de jetzt mit kostenlosem Kündigungsgenerator --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
