Doctrine column based on two references

     

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.

  
"
answer1
  
  

You need to add AttributeType entity


Type <-- Device <-- Attribute(value) --> AttributeType