Skip to content

[Form] ChoiceType is still calling the removed PostSubmitEvent::setData() #52829

Closed
symfony/symfony-docs
#19206
@ThomasLandauer

Description

@ThomasLandauer

Symfony version(s) affected

7.0.0

Description

@HeahDude in #51043 you removed FormEvent::setData().

But ChoiceType::buildForm() still contains this line at https://github.com/symfony/symfony/blob/7.1/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php#L162

$event->setData($knownValues);

But this will now lead to a BadMethodCallException in PostSetDataEvent and PostSubmitEvent.

Did you overlook this? Or is this line never executed in fact (and thus could be deleted)?

How to reproduce

See above.

Possible Solution

No response

Additional Context

No response

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