Skip to content

Form with an EntityType field with multiple=true giving back array and ArrayCollection #23927

Closed
@stoccc

Description

@stoccc
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 2.8.22

I have a strange behaviour with a form (mapped to an array, not to a Entity) containing a field of type EntityType with multiple=true.

If I set that field with initial data an empty array, e.g. array(), after successful submit when I call $form->getData() I get an ArrayCollection for that field.

Instead, if I set that field with initial data a non empty array, after a successful submit when I call $form->getData() I get a simple array for that field.

Shouldn't I obtain always the same type?

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