I can't seem to figure out how to get this working with Symfony2 forms.
My database structure looks like this : (i'm using the hasOne, hasMany notation for simplification and understanding)
Object (this is the class name)
hasOne ObjectType
hasMany ObjectValues
response
ObjectType
hasMany ObjectTypeFields
name
ObjectTypeField
name
datatype
ObjectValue
hasOne Object
hasOne ObjectTypeField
value
From the above defined structure, I have an ObjectType called "Appointment" let's say. This ObjectType has two related fields (in ObjectTypeField) : let's say, "date" and "time".
So if I do $objectType->getFields(), I get two objects named "date" and "time" respectively.
I have a form class for my Object Class (ObjectType.php in Bundle/Form/Type). When I create a new Object, I want the form to have all the properties present in the Object class but also the ObjectTypeField properties which are related through the ObjectType class. So, my goal if I create a new "Appointment" object, is to have a form that has fields for "response" which is part of the Object object but also "date" and "time" which are related fields through the ObjectType of my "Appointment" object. Obviously, the values of these 2 fields can't be saved to the Object object because those properties don't exist there. They should be saved as ObjectValues related to the Object and the ObjectTypeField...
I don't understand how to do this with embedded forms because of the variable properties and where they have to be saved.
Anybody have an idea? I'm on Symfony 2.3.6 with Doctrine.
Thanks!