Welcome Guest, Not a member yet? Register   Sign In
Datamapper ORM Multi-tabel Relationship Halp!
#7

[eluser]Genki1[/eluser]
Your idea of Purchases "has one" Option is throwing me off because there are multiple Options applied to each Template. Maybe my scenario is not clear. Here's what I'm doing:

Quote:A User purchases a Template.
There is a library of 15 configuration settings (I called them "Options" in my posting here).
Several of the config settings are automatically applied to the Template and are set with a default value which the user can change. (Note: user purchases only the Template, not the config settings/options.)

Example of two purchases:

User "Joe" purchases the "Blue Sky" template. Ten of the 15 config settings are automatically applied to the template and each setting is loaded with a default value.

User "Harro" purchases the "Gentle Valley" template. Twelve of the 15 config settings are automatically applied to this template and loaded with default values.

Code:
User: Joe
Template: Blue Sky
Config settings:
[option_id] [option_name]     [value]
  1           Font              Arial
  2           Background color  Blue
  3           State             California

Code:
User: Harro
Template: Gentle Valley
Config settings:
[option_id] [option_name]     [value]
  1           Font              Helvetica
  3           State             Hawaii
  5           Position          Center
  6           Foreground image  Sunflowers

So, as in my earlier post, I envision my "Purchases" table looking like this:

Code:
[id] [user_id] [template_id] [option_id] [value]
  1       1         1             1        Arial
  2       1         1             2        Blue
  3       1         1             3        California
  4       2         7             1        Helvetica
  5       2         7             3        Hawaii
  6       2         7             5        Center
  7       2         7             6        Sunflowers
Based on this, how can Purchases be "has_one" to Options?


Messages In This Thread
Datamapper ORM Multi-tabel Relationship Halp! - by El Forum - 07-27-2011, 12:34 PM
Datamapper ORM Multi-tabel Relationship Halp! - by El Forum - 07-28-2011, 02:04 AM
Datamapper ORM Multi-tabel Relationship Halp! - by El Forum - 08-04-2011, 07:18 PM
Datamapper ORM Multi-tabel Relationship Halp! - by El Forum - 08-05-2011, 04:49 AM
Datamapper ORM Multi-tabel Relationship Halp! - by El Forum - 08-05-2011, 08:54 AM
Datamapper ORM Multi-tabel Relationship Halp! - by El Forum - 08-05-2011, 11:37 AM
Datamapper ORM Multi-tabel Relationship Halp! - by El Forum - 08-06-2011, 03:44 AM
Datamapper ORM Multi-tabel Relationship Halp! - by El Forum - 08-06-2011, 04:01 AM
Datamapper ORM Multi-tabel Relationship Halp! - by El Forum - 08-06-2011, 01:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB