Modeling products with completely different sets of necessary information and their linking to lines?

I am currently working on a site that sells custom-made products of various types. I have a common standard basket diagram: the order has a lot of linear elements, LineItems has one product, but I ran into some problem:

Let's say that one of our products is a ball, and one of our products is a box of crayons. While people create their order, we create elements that can be represented by some psuedocode:

Ball:
  attributes:
     diameter: decimal
     color: foreign_ref_to Colors.id
     material: foreign_ref to Materials.id
CrayonBox:
  attributes:
     width: decimal
     height: decimal
     front_text: string
     crayons: many_to_many with Crayon
...

db , . , , , , Ball CrayonBox LineItem, .

, :

: " " , - :

LineItem
  information: many_to_many with product_information
  ...
ProductInformation:
  lineitem: many_to_many with line_item
  name: string
  value: string

ProductInformation(name='color', value=$SOMECOLOR)
ProductInformation(name='color', value=$SOMEOTHERCOLOR)
...

, , , . , $DEITY , , .

, , LineItem, , . , , . , , , .

, , , , , ? db , eval() , - , eval() .

: " , " .

, , , , ? ? , , googling - ? ? " RDBMS ", ?

: , . , "" , "info" . , ORM, (Doctrine 1.2), . , - " " Doctrine, egh. - , ? EAV, , - , A B. EAV , db .

+4
3

, CouchDB/MongoDB, , . MySQL "nosql" .

+1

.

0

:

, . , , . , .

, , . I., ; crayon_boxes , , ... , .

( - RBDM, , , ) - . , :

Products

+ ProductName
+ ProductAttribute

:

  • = "Crayon Box"
  • = ": 5 , : 7 "

- , /, .

0

All Articles