Skip to content

[Form] empty_data in ChoiceType can be a string what must not be called #25896

Closed
@peter-gribanov

Description

@peter-gribanov
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 2.8.33

Example problem:

->add('order', ChoiceType::class, [
    'expanded' => true,
    'choices' => [
        'view' => 'news.search.order.view',
        'name' => 'news.search.order.name',
        'date' => 'news.search.order.date',
    ],
    'empty_data' => 'date',
])

In this case, i get an error at this line:

Warning: date() expects parameter 1 to be string, object given

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