I have a relationship from Assembly to ComponentSlot. This is a OneToMany relationship.
// Assembly /** * @ORM\OneToMany(targetEntity="ComponentSlot", mappedBy="assembly", cascade={"persist"}) * @Assert\Valid */ protected $componentSlots; // ComponentSlot /** * @ORM\ManyToOne(targetEntity="Assembly", inversedBy="componentSlots") */ protected $assembly;
The schema generated in the database is absolutely beautiful. The right columns, the right indexes and relationships.
The Symfony2 AssemblyType form has a ComponentSlotType collection. I can add several child components of ComponentSlot. When saved, all Assembly and ComponentSlot children are preserved perfectly, except that assembly_id is NULL in the component slot table.
I copied the settings that I had in the previous project, which perfectly preserved the relationship, I'm completely at a dead end. Cascading emphasis is set in the ComponSlots Assembly fields, and my past experience with OneToMany is that I don't need to do anything here, it should be taken care of.
Any pointers would be appreciated :)
source share