umm I might have asked the question wrong. here is what I am trying to
do:

I have 3 tables: orders, order_items, and order_notes

Orders is full of all of my store's orders. Order items are all the
items the customer purchased, and order_notes contains all of the
notes associated with an order. so the tables look like:

orders:

id
date
customer_name
customer_phone
customer_etc
total

order_items:

id
order_id
name
description
price
sku

order_notes:
order_id
note
date

So it isn't a many-to-many association, it's just two one-to-many
associates.

On Nov 30, 9:17 am, Anupom <[EMAIL PROTECTED]> wrote:
> 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