[SOLVED]table design and Yii relations prob

Hi,

I have a menu, it’s hard coded it contains about 8 menus.

under each should show the list of products available.

I have a products table. Actually it has a crud already,

only an admin can create products.

Problem: when I create a product, system doesn’t know to which

menu should the product fall under.

I need help/suggestions/tips how to design the next table that I should create

in order to link the proper product to the correct menu

e.g product can fall under 1 or 2 or 3 or many menus.

and also the Yii relations array for this ?

Thanks in advance :D

You should create a many many relation menu-product, with a table for save the primary key pairs

let’s say I create a table named menu_category,

  1. do I need to create a model for that?

  2. how should I do the relation ?

  3. should I do the relationship in the Product model like e.g




'menu' => array(self::MANY_MANY, 'Menu_category', 'menu_category(menuid,productid)')



is that snippet i pasted has the correct logic in it?

am a bit confused :D