Suppose (for lack of better example) I have a model Person and another model Twin (meaning a pair of twins). Twins has two Person foreign keys, say first_born_id and second_born_id referencing the id fields of two different people (in Person). How do I set up the relationships in cake?
I guess Twin would have something like:
$belongsTo = array('FirstBorn' => array('className' => 'Person',
'foreignKey' => 'firstborn_id'),
'SecondBorn' => array('className' => 'Person',
'foreignKey' => 'secondborn_id'));
But how should I set up Person? I could do it like:
$hasOne = array('TwinAsFirstborn' => array('className' => 'Twin',
'foreignKey' => 'firstborn_id'),
'TwinAsSecondborn' => array('className' => 'Twin',
'foreignKey' => 'secondborn_id'));
But then when I have a Person and I want to know about its twin I would need to check both relationships. I guess I am hoping there is a way to get a "Twin" relationship in Person representing any of the two ways a Person can be in a Twin relationship.
Or is there a better way to set this up?