Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Description
Instructions about delete_empty are partially ok. It instructs only that allow_delete must be enabled.
If you have a collection of another form type, and you want that empty items are deleted, you have to dig around the web (old issues and wrong workarounds), to discover that you just have to setentry_options => array('required' => false) at the collection definition.
I've discovered this searching in the issues. And foundsymfony/symfony#13940 which points tohttps://github.com/symfony/Form/blob/master/Tests/Extension/Core/Type/CollectionTypeTest.php#L145-166
I think, we could update the collection doc, in the section of delete_empty, to warn the developers about this behavior. And, why thisentry_options => array('required' => false) makes sense? In my opinion, i think it is not legible. I'm available to help!
UPDATE
I have just found, whyrequired => false makes sense.http://symfony.com/doc/2.8/reference/forms/types/form.html#empty-data