Essentially I cannot remove a collection with orphanRemoval if the builder has a hiddenType attached. I'm not sure if there is something special that I need to do for the hiddenType field to be able to remove it. Everything works fine without the hiddenType field, but once I add the field to the builder the remove function never gets called when I remove the collection and then I get a db error telling me fields can't be null.
I am using js to dynamically add and remove the collections if that is helpful. But the strange thing is that this works fine without the hidden field so I'm wondering if there is just something to do with hidden fields that is distinct from other field types.
this doesn't work
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->add(...some fields...)
->add('sampleindex', HiddenType::class);
}
this does
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->add(...some fields...)
}
The field works in general, just not removing the collection. The setter and getter is pretty much boiler plate
public function getSampleIndex() {
return $this->sampleindex;
}
public function setSampleIndex($sampleindex) {
$this->sampleindex=$sampleindex;
}
I just can't see what the difference is between the hiddenType and any other field type that would cause the remove function to fail to be called.