Hello, I have 3 tables:
1. posts 2. categories 3. post_2_cat I am trying to use hasAndBelongsToMany to fetch a post and its associated categories (from post_2_cat) The only problem i encountered so far is with table fields names. Initially i had post_id and category_id in the posts and categories tables. This way, i dont get anything returned with hasAndBelongsToMany. If i modify the fields names to 'id' , i get the expected results. var $hasAndBelongsToMany=array('Category'=> array('className' => 'Category', 'joinTable' => 'post_2_cat', 'foreignKey' => 'post_id', 'associationForeignKey'=> 'cat_id', 'conditions' => '', 'order' => '', 'limit' => '', 'unique' => true, 'finderQuery' => '', 'deleteQuery' => '', ) Above is the code that does this (resides in models/post.php). My question is, how can i use hasAndBelongToMany but not have to use "id" in my tables (for example i want to use: post_id instead of id , in the posts table). Thanks in advance. Also, any other advices are welcome as im quite new to cakephp (which rocks btw :) ) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---