I'm stuck and reading the documentation doesn't seem to be helping me out.
I have one to many relationships working, all though I'm sure there is an easier way, I'm stuck when it comes to Many to Many relationships.
I've tried quite a few things, but basically I have three tables:
homes:
- id
- address_id
- price
- etc
features:
- id
- name
features_homes
- id
- feature_id
- home_id
I've setup my model quite a few different ways.
var $has_many = array(
'feature' => array(
'class' => 'feature',
'other_field' => 'home',
'join_self_as' => 'home',
'join_other_as' => 'feature',
'join_table' => 'features_homes'
)
);
And the basic version of
var $has_many = array('feature');
The problem is I can't figure out how to get multiple records associated with the home.
I end up with a single item rather than a group of items.
Example output:
[id] => 1
[address_id] => 1
[latlong] => 00.000, -00.00000
...
[feature_id] => 1
[feature_name] => Hard Wood Floors
I am trying to get
[id] => 1
[address_id] => 1
[latlong] => 00.000, -00.00000
...
[features] => // Object of all items