This depends on how you want to build your sub categories tree:

 

Is it a relationship like this:

 

category

  id

  parent_id

 

or

 

category

  id

 

sub_category

  id

  category_id

  parent_sub_category

 

your product could be

 

product

  id

  ...

 

Then a join table

 

categories_products

  id

  product_id

  category_id

 

 

or you could have 

 

product

  id

  category_id

 

product_sub_categories

  id

  product_id

  sub_category_id

 

it really depends on what your data model requirements are.

 

The join table will be extremely useful in establishing the HABTM
relationships you require.

 

Cake bake will not automatically detect recursive parent_id as a category.
so you will have to define that manually.

 

-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Beedge
Sent: 2009-06-04 10:46
To: CakePHP
Subject: A little help needed on determining my model relation ships please

 

 

Hi all, about to start on my first cake project. A straight forward e-

commerce site.

I am not used to having to visualise my database relationships so I

was hoping for a little help.

 

A product belongs in a category

A product can be in many categories

A Category has Sub categories

 

Is this just a HABTM relationship between products and categories?

 

I will be using tree behavior for my categories.

 

Any comments on this or helpers?  I would love to find a tutorial that

covered this, but all I can really find is blog tutorials!

 

Thanks in advance

 

Kev



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

<<inline: image001.gif>>

Reply via email to