It does, but you still need a model for the link. If I remember
correctly anyway.

I think Danielle is correct here though. Your database structure is
overcomplicated a little - you could achieve the same goal by having:

Size:-
id
size
shortCode

Colour:-
id
colour

Style:-
id
style
description

Stock:-
id
size_id
colour_id
style_id
quantity

With the Stock model being linked to the others via belongsTo. No real
need for a HABTM at all.

Steve


On Jan 22, 5:25 am, david_setwise <[EMAIL PROTECTED]> wrote:
> Doesn't CakePHP 1.2 support additional fields in a HABTM table?
>
> David
>
> On Jan 21, 6:15 pm, Ponderosa - Lists
>
> <[EMAIL PROTECTED]> wrote:
> > Your colors_shirts_sizes table should be a new table/model inventory.
>
> > Inventory
> > - id
> > - shirt_id
> > - size_id
> > - color_id
> > - inventory_qty
> > ... any other inventory information needed such as location etc.
>
> > As soon as you need more than just the cross reference id's in the table
> > (like your inventory quantity) it needs to be its own model.
>
> > Danielle
>
> > -----Original Message-----
> > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
>
> > Of david_setwise
> > Sent: January 21, 2008 3:03 PM
> > To: Cake PHP
> > Subject: Connecting Two HABTM Tables
>
> > Here is a potential situation in which it seems like two HABTM tables
> > should be connected.  So, am I incorrect in my table structure.  If
> > not, can Cake handle connecting two HABTM tables?
>
> > The system in question deals with clothing.  So imagine shirts of
> > various types that can have multiple sizes and colors, with the
> > ability to track inventory.
>
> > The first HABTM is fairly straight forward: Colors > Colors_Shirts >
> > Shirts
>
> > But if I want to add in sizes, with an inventory for each combination
> > (Plain T-shirt, Green, Size Medium, inventory 20) it get complicated.
> > I envision the correct database structure/relationship as having the
> > Sizes table connected to the Colors_Shirts table with a HABTM
> > relationship, in which the inventory is stored.
>
> > Colors_Shirts > Colors_Shirts_Sizes (with field for inventory) > Sizes
>
> > So, is this the way you would structure the database?  If so, can Cake
> > handle such a relationship?  And if not, does anyone have a decent
> > alternative?
>
> > Colors
> >  - color_id
> >  - name
>
> > Shirts
> >  - shirt_id
> >  - name
> >  - description
>
> > Sizes
> >  - size_id
> >  - shortCode
>
> > Colors_Shirts
> >  - color_id
> >  - shirt_id
>
> > Colors_Shirts_Sizes
> >  - color_id
> >  - shirt_id
> >  - size_id
> >  - inventory
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to