Tuesday, October 27, 2009

Re: Nested HABTM brainstorming / how to

My guess:

You want to define a package as a collection of products, each product
with specific options.

Thus the following associations:
Product HABTM Option - defines the allowable options for the product.
SpecializedProduct belongsTo Product - defines a specialization of a
product.
SpecializedProduct HABTM Option - defines the options for the
specialized product.
Package HABTM SpecializedProduct - collects the specialized products.

Enjoy,
John

On Oct 27, 11:08 pm, r4zv4n <razvanbra...@gmail.com> wrote:
> Hi guys :)
>
> I currently have a "products" table that HABTM "options". There is
> also a "packages" table, which HABTM "products". So far so good. The
> tricky thing is that when building packages, I want to *only* have
> certain options available for each package.
>
> Example:
>
> Product 1 has Option A, Option B and Option C
> Product 2 has Option C, Option D and Option F
>
> I want to have a Package that will be made of Product 1 with Option A
> plus Option B and Product 2 with Option C plus Option F, for example.
> The way I have them set up now, adding Product 1 and Product 2 to the
> Package will show them with all their options.
>
> My idea would be to HABTM the link table for Packages_Products with
> the Options table - but I'm not really sure how that will impact
> performance and if the automagic of Cake will still work.
>
> What are your suggestions on this matter?
>
> Thanks in advance,
>
> Razvan
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: