Hi Anja

Sorry, I think I've replied too fast: $uses is for controllers, not
models... (I think you need to use App::import("Model","otherModel")
to use a non-associated model)

Anyway, if your model belongsTo your otherModel (and thus your
otherModel hasOne or hasMany your model), then from your model, your
otherModel should be accessible with:
$this->otherModel

+++++++
Clément

On Mon, Oct 6, 2008 at 1:26 PM, Liebermann, Anja Carolin
<[EMAIL PROTECTED]> wrote:
>
> 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: [email protected] [mailto:[EMAIL PROTECTED] Im Auftrag von clemos
> Gesendet: Montag, 6. Oktober 2008 12:29
> An: [email protected]
> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to