Skip to content

[Form] delete_empty don't work for embedded forms without data_class #22008

Closed
@murilolobato

Description

@murilolobato
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 2.8.18

I'm creating a form, that has a collection of another form. OrderType has a collection of ItemType. Assuming that both have the option data_class = null, empty items are not being removed during form submit. Empty Items are being validated. The expected behavior was that empty items would be removed, as it happens when I create entities for this two types and set them in type's data_class options.

Looking at the source code and other issues, people already have had problem with delete_empty, but this is a new case. I've also found the tests to delete_empty and the scenario I've listed above is not being tested.

Here is the test with data_class defined: https://github.com/symfony/Form/blob/master/Tests/Extension/Core/Type/CollectionTypeTest.php#L145

I'll try to create a test, and attach to this issue, but I can't promise anything.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions