On Jul 18, 2006, at 10:21 AM, calzone wrote:
>
> Can someone direct me to documentation about how to set up multiple
> different relationships between the same two models?
If they are the same type of relationship, just add another
assocation to the array. If I have two belongsTo relationships, I
just add it in:
var $belongsTo = array(
'firstOne' => array('className' => 'model'),
'secondOne' => array('className' => 'model')
)
If a model has two different assocations, you just define both vars:
var $belongsTo = array(
'firstOne' => array('className' => 'model')
);
var $hasMany = array(
'anotherOne' => array('className' => 'model')
);
-- John
>
> For instance, Fred is a Sales Rep for ACME Parts, his clients include
> ABC Auto, Repair 123, and many other companies. Fred belongsTo ACME
> but hasMany clients, all of which are company entities.
>
> Another example could be that Fred belongsTo one supervisor and
> belongsTo one doctor, and hasOne partner. Obviously, if Fred himself
> if a supervisor, it could be said that he hasMany reports. In these
> examples, the two tables are the same.
>
> Regardless, there could be many other cases where there are multiple
> kinds of relationships set up going in both directions between the
> same
> two models. I wasn't sure how to search for this material, either
> here
> or in the wiki, so I'm hoping someone who knows can tell me where to
> find out.
>
> thanks
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---