Add the following associations:
Item hasMany ItemOrder
ItemOrder hasMany Variation
ItemOrder belongsTo Item

Enjoy,
   John

On Oct 15, 10:39 am, TimG <[email protected]> wrote:
> Here is what I have:
>
> Models:
> Order (HABTM with Item)
> Item (HABTM with Order)
> ItemsOrder (join table)
> Variation (belongs to ItemsOrder)
>
> Here is my issue: I can get to the Variation model through the
> ItemsOrder model if I start at the ItemsOrder model. But if I start at
> Order and go to the ItemsOrder model through the HABTM it won't
> recurse any further to the Variation model.
>
> Here is something I was trying to make work but the last condition is
> not valid:
>
> --------
> ---------------------------------------------------------------------------------------
> --------
> $this->Order->Behaviors->attach('Containable');
>
> $this->set('order', $this->Order->find('first', array(
>       'conditions' => array('Order.id' => $orderId),
>       'contain'=>array(
>             'Item' => array('fields' => array('id','title'),
>                   'ItemsOrder' => array('conditions' => array
> ('ItemsOrder.order_id' => $orderId),
>                         'Variation' => array(
>                               'conditions' => array('Variation.id' =>
> 'ItemsOrder.variation.id')
> )))))));
> --------
> ---------------------------------------------------------------------------------------
> --------
>
> Any ideas on how I can get these associations to work through the join
> table?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to