Hi,

I'm trying to figure out the best way to approach a config issue in an
app I'm working on.

The system has Products and Product Categories. Some of the Product
Categories require some configuration for each user, this is also true
of some Products.

I'm trying to figure out the best way of modelling this in the DB,
does anyone have any experience of this type of thing?

I have a half working version based on the following (but I'm not sure
it's the best approach):

// Models
ProductCategory
- hasMany Product, ProductCategoryConfigQuestion

Product
- belongsTo ProductCategory

User
- hasMany ProductCategoryConfigAnswer

ProductCategoryConfigQuestion
- belongsTo ProductCategory
- hasMany ProductCategoryConfigAnswer

ProductCategoryConfigAnswer
- belongsTo ProductCategoryConfigQuestion, User

So I can create a form on the fly, I have the following in
ProductCategoryConfigOption:

id
product_category_id
name
field_type (text, textarea, select)
field_values (used for select)

This works ok, and I can display the form correctly and then save the
results - it just feels clunky! For instance I can't use Cake's built
in validation, and I will need to recreate the Question and Answer
tables for Products (and the controller functionality).

I've looked about, and there's a component on the bakery [1] however
this uses Keys, which I could use, though it would have to be a
composite based on the user id, product_category_id and config_option.
Also this doesn't take into account the fact I need to associate an
answer to a question.

I'm not sure I'm going about this the correct way, and would
appreciate some insight.

Thanks,

Jon
[1] 
http://bakery.cakephp.org/articles/view/confcomponent-db-based-configuration-tutorial

-- 


jon bennett

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