[eluser]Tom Vogt[/eluser]
I'm having some trouble with what should be a simple self-relationship. Maybe someone can point out where I went wrong.
Goal:
I have a set of regions/places.
These are connected with each other in a non-hierarchical graph, like a roadmap.
I've set these up as a many-to-many relationship in the model:
Code:
var $has_many = array('from'=>array('class'=>'region', 'other_field'=>'to'), 'to'=>array('class'=>'region', 'other_field'=>'from'),
and my database has a join table called "froms_toes" with three fields: id, from_id and to_id
Now I want a list of all the connections, and thought
Code:
$regions = new Region();
$regions->get()->to->get()
would give it to me. But it doesn't, it only gives me a few regions, and no data about the connections.