If I want to create a category and be able to link products to it by
tags I can like so:

 - Create the category and product tables.
 - Create a tags table with tags like: Ruby, Earrings, White-Gold
 - Create a category_tags and product_tags table to map them
 - Set category and product to hasAndBelongsToMany tags
 - Set tags to hasAndBelongsToMany products and hasAndBelongsToMany
categories
 - Now say I have 2 products one with tags: Ruby and Earrings and
another with tags: Ruby and Bracelet

Say I want to create a "Ruby Earrings" category.

I could add the Ruby and Earrings tags to the category. But under
normal HABTM Model associations both products will be returned because
even though only 1 has an earrings tag they both have a ruby tag.

How can I make it only match products that have ALL of the same tags
as the category (products can have more tags but must have all the
tags the corresponding category has) in order be returned?

Also, taking that even further, how could I add -tags to a category
that the products must NOT have these tags to be returned?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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