sonata_type_collection : set default field value from current entity instance sonata_type_collection : set default field value from current entity instance symfony symfony

sonata_type_collection : set default field value from current entity instance


I found the solution, and it was quite simple, i'm ashamed =__="I forgot to set a reference to the MachineInfo in the newly instantiated MachinePart

public function addMachinePart(MachinePartsInfo $machineParts) {    $machineParts->setMachineInfo($this); //Missed this line    $this->machineParts[] = $machineParts;    return $this;}

I hope this can help someone in the future :)