I'm upgrading a 2-year-old project and need to create more complex model relationships; I'm a little out of my depth.
I had these tables:
- items
- addons
- orders
- items_addons
Now I've added these tables:
- orders_items
- orders_items_addons
I am getting lost in updating my model associations (vis-a-vis brain-to-mush phenomenon), and consequently I can't get Cake to include orders_items_addons
in find()
operations from OrdersController, independent of how deep recursion is.
I have these associations:
HasAndBelongsToMany
- Order: Item
- Item: Order, Addon
- Addon: Item, OrdersItem
BelongsToMany
- ItemsAddon: Item, Addon
- OrdersItem: Order, Item
- OrdersItemsAddon: OrdersItem, Addon
(I can post the foreign key/classname/join-table info if needed but I'm pretty sure I have these right.)
When executing this $this->Order->find('all')
, however, I'd been expecting the key $result['n']['OrderItem']
to exist and it does not, nor is $this->Order->OrderItem
a valid magic-method.
Can anyone help me get a handle on this?