Join tables should be named after the tables that will join, in
alphabetical order, with underscores in between. As an example, a join
table between posts and tags tables should be named posts_tags, not
tags_posts.

The default value of the foreign keys used in the join table must be
underscored, singular name of the models in relation, suffixed with
'_id'.
Like, post_id, tag_id.

If you want to override the defaults, you can explicitly define it in
the association attribute of the model -

<?php
class Post extends AppModel
{
        var $name = 'Post';
        
         var $hasAndBelongsToMany = array(
        'Tag' =>
            array('className'            => 'Tag',
                'joinTable'              => 'tags_posts, //altered the
default - posts_tags
                'foreignKey'             => 'article_id', //altered
the default -post_id
                'associationForeignKey'  => 'category_id' //altered
the default - tag_id
            )
        );
}
?>



On Nov 30, 2007 11:12 PM, Jon Bennett <[EMAIL PROTECTED]> wrote:
>
> > Always best to stick to a A-Z (why can't I think of the correct term for 
> > that!)
>
> ALPHABETICAL!!!!
>
>
> cheers,
>
> jon
>
> --
>
> jon bennett
> w: http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
>
> >
>



-- 
Thanks
Anupom
Trippert Inc. [http://www.trippert.com]
GopherNow. [http://www.gophernow.com/]
Homepage. [http://www.anupom.wordpress.com/]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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