Closed
Description
Running on an application with SF2.8, before migrating it to SF3. What I got here is, at some point in a form
// BarType.php
$builder->add('foo', CollectionType::class, [
'entry_type' => new FooType(),
'error_bubbling' => false,
'allow_add' => true,
'allow_delete' => true,
]);
Reading this I found that we need to change entry_type
of forms from new FooType()
to FooType::class
.
But I've noticed something very weird: if I change entry_type
from instance to FQCN and in embedded form (FooType
) I use something like
// FooType.php
$resolver->setDefaults([
'data_class' => 'Vendor\Bundle\Entity\Foo',
'empty_data' => new Foo(),
]);
Then, every object added to the collection are "collapsed" into the same one (e.g.: I add three elements, after form binding I got three Foo
elements in my Bar
object but they're all the same).
Unfortunately, now, I cannot write an example to let give you a better understand of what is going on here but I will do in the next days if anyone need it.