Hello,

i've hopeness, that you can help me.

the situation:
i've 2 relations/tables 'members' and 'friends'. The last one has two
foreign keys to 'members', so that is 'members' connected with
himself, over the relation/table 'friends. It's clear, becaus every
member can be a friend of anybody else.

example:
Table members
mID | fname | lname
1 | Steve | Lawler
2 | Christian | Beyer
3 | Michael | White

Table friends
fID | mID1 | mID2 | confirmation
1 | 1 | 2 | ASKED
2 | 1 | 3 FRIENDS

That means, that Steve Lawler (ID=1) is a Friend of Michael White
(ID=3). Also it means, that Steve Lawler wants to be a Friend
(confirmation=ASKED) of Christian Beyer (ID=2).
How can I say this to the FriendModel of CakePHP?

my PHP-Code

PHP-Code:
// first DRAFT
var $belongsTo = array(
     'Member' => array(
           'class' => 'Member',
           'foreignKey' => 'mID1'
     ),
     'Member' => array(
           'class' => 'Member',
           'foreignKey' => 'mID2'
     ),
)

This draft is false - clearly, because of the Index 'Member', which
will be overwritten.
I've thought about... and my next idea was $hasMany, but this is also
no solution.
In general I've to write, that the FriendModel belongsTo the
MemberModel - twice.

Reason:
Clearly, if I do the following Call
$this->Friend->findAllByconfirmation(ASKED)
I wants to get an result array, with to indices of member, something
like that
$[Friend][0]['member'][l'name'] instead of $['Friend']['Member']
['lname'], because there are two mIDs connected to table 'Members' on
table 'Friends'.

I look forward, to get some help from you :-)

yours sincerely


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to