Hi clemos! Thank you for your helpful answer. Another question: Is the $uses variable also necessary if my model benlongsto the otherModel? Means it is already included in the $belongsTo array. Or does the belongsto-relation only work for the foreignkey connection?
Thanks a lot! Anja -----Ursprüngliche Nachricht----- Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von clemos Gesendet: Montag, 6. Oktober 2008 12:29 An: cake-php@googlegroups.com Betreff: Re: requestAction in model method allowed? Hi Yes, it is almost total nonsense, IMHO, because you shouldn't need to go through controllers to pass data from one model to another... Accessing to a model from another associated model is done like that: $other_model_data = $this->OtherModel->getValues($othermodelid); // "$this" reprensents your Hotel model If your other model is not already associated, you can add it to the $uses property of your first model to access it: var $uses = array("AssociedModel1","AssociedModel2","OtherModel"); ++++++ Clément On Mon, Oct 6, 2008 at 12:15 PM, Liebermann, Anja Carolin <[EMAIL PROTECTED]> wrote: > > Hello, > > I have a method in a model and want to read values from another model > in a method. > > Model: Hotel > > function getanothermodelsvaules($othermodelid){ > //some code > $othermodel = > $this->requestAction($this->othermodels/getMyValues/'.$othermodelid); > //some more code > } > > Question: Is this complete nonsense? Can / Should I do it this way? > > Thank you > Anja > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---