So in English, the relationship would sound like "This event is related to to the following other events".
My first instinct is to create an EventEvent
model, with a first_event_id
field and a second_event_id
field. Then I would define the following two relationships in the Event
model:
$this->hasMany('Event as FirstRelatedEvents', array('local' => 'first_event_id', 'foreign' => 'second_event_id', 'refClass' => 'EventEvent'));
$this->hasMany('Event as SecondRelatedEvents', array('local' => 'second_event_id', 'foreign' => 'first_event_id', 'refClass' => 'EventEvent'));
But I would rather not have to use two relationships on the Event
model. Is there a better way to do this?