Skip to content

Document that "empty_data" requires data in view format #6340

Closed
@webmozart

Description

@webmozart

It should be documented with the "empty_data" option that the data must be passed in view format, in case that differs from model format. For IntegerType, for example, "empty_data" must be set to a string value, not an integer (conversely to what you would intuitively expect):

$builder->add('number', IntegerType::class, [
    'empty_data' => '0', // not: 0
]);

See symfony/symfony#18047

Metadata

Metadata

Assignees

No one assigned

    Labels

    FormKeep openactionableClear and specific issues ready for anyone to take them.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions