Hi guys, Yep, another HABTM question I'm afraid... but I haven't been able to find the answer to this one on the group, so maybe it hasn't been brought up yet :)
My app contains a model merchants, each of which hasAndBelongsToMany related merchants. No problem, I just use this code in the merchant model: var $hasAndBelongsToMany = array('Merchant'=>array('classname'=>'Merchant', 'joinTable'=>'related_merchants', 'foreignKey'=>'merchant1_id', 'associationForeignKey'=>'merchant2_id')); The problem comes when the data is retrieved from the DB. Imagine 'merchants' had a conventional HABTM relationship with 'customers'. we would have: $data['Merchant'] (containing the data about the merchant) $data['Customer'] (containing an array of the associated customers) However, with the related merchants their information is put inside the $data['Merchant'] array! So we have $data['Merchant']['id'] (id of the merchant) $data['Merchant']['name'] (name of the merchant) $data['Merchant'][0] (array containing the info for the first related merchant) $data['Merchant'][1] (array containing the info for the second related merchant) etc. I think this is messy and would prefer to have something like: $data['Merchant'] (containing the data about the merchant) $data['RelatedMerchant'] (containing an array of the related merchants) Does anyone know how to do this? Thanks! David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---