1

i have a problem with doctrine.

I want to create the following classes in symfony:

Device

  • id
  • name
  • type

Type

  • id
  • name
  • attributes

Attribute

  • id
  • name
  • value

The problem is that the value from the attribute class based on the device. So how i have to annotate this?

Edit: One device has one typ, and one type has multiple attributes. But a second device with the same type and the same attributes has other values.

Device1 with type thermometer and attribute temperature has the value 15° C. Device2 with type thermometer and attribute temperature has the value 20° C.

  • Can you describe the relations you'll need ? Something like: One device to one type and many types to one device ? What about the relations with attribute class ? – Rumen Panchev May 16 '17 at 13:45

1 Answers1

0

You need to add AttributeType entity

Type <-- Device <-- Attribute(value) --> AttributeType
mochalygin
  • 739
  • 6
  • 14