I have EntityA which has one or more EntityB's which have one or more EntityC's. EntityB references values of EntityA and EntityC references values of EntityB. My current plan is to have an id field of EntityB reference the id of EntityA and the same for EntityC referencing EntityB. Normal one-to-many relationships, possibly with foreign keys defined so mysql will enforce referential integrity.
I am trying to use the Subform module to build the lists of required forms inside the edit form for EntityA. EntityA builds the settings for a new EntityB into an object and passes that to EntityB's form via Subform '#subform_arguments'.
My question is about how to save EntityB and EntityC forms. Should I save EntityB in the submit function for EntityA or try to communicate EntityA's id to the EntityB submit function and have it save its own entity? If the save logic for EntityB goes in the submit function for EntityA's form, how do I retrieve the subform values to save?