Thank you that worked! I really appreciate that and thanks for enlightening me about 'with'.
I have a follow up question pretty please: now I'm having the same problem with trying to find all terms in a given context. I'm trying to use 'with' but it doesn't seem to behave or I'm missing something.. This: $joinRecords = $this->Term->ContextsTerm- >findAll(array('ContextsTerm.context_no' => 6)); it creates this query which fails on trying to find the wrong key names SELECT `ContextsTerm`.`context_no`, `ContextsTerm`.`term_no`, `Context`.`no`, `Context`.`name`, `Context`.`description`, `Term`.`no`, `Term`.`term`, `Term`.`term_nice`, `Term`.`display`, `Term`.`import_date` FROM `contexts_terms` AS `ContextsTerm` LEFT JOIN `contexts` AS `Context` ON (`ContextsTerm`.`context_id` = `Context`.`no`) LEFT JOIN `terms` AS `Term` ON (`ContextsTerm`.`term_id` = `Term`.`no`) WHERE `ContextsTerm`.`context_no` = 6 it's like this: class ContextsTerm extends AppModel { var $name = 'ContextsTerm'; var $belongsTo = array('Context','Term'); } class Term extends AppModel { var $name = 'Term'; var $displayField = 'term_nice'; var $primaryKey = 'no'; var $hasAndBelongsToMany = array( 'Context' => array( 'joinTable' => 'contexts_terms', 'foreignKey' => 'term_no', 'associationForeignKey' => 'context_no', 'with' => 'ContextsTerm' ) ); } class Context extends AppModel { var $name = 'Context'; var $displayField = 'name'; var $primaryKey = 'no'; var $hasAndBelongsToMany = array( 'Term' => array( 'joinTable' => 'contexts_terms', 'foreignKey' => 'context_no', 'associationForeignKey' => 'term_no', 'with' => 'ContextsTerm' ) ); } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---