Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Closed
@stoccc

Description

@stoccc
Issue body actions
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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.