EasyCorp/EasyAdminBundle

ChoiceField select html choices in CollectionField

brunomartin opened this issue · 0 comments

Describe the bug
Explain what you wanted to do and the wrong result you got.
When using ChoiceField in edit form, html select element choices are limited to the ones given a CrudController:
Capture d’écran 2024-04-14 à 22 25 13

When using the same in a CollectionField, the Tom Select clear-button element is available making possible to choose an empty choice:
Capture d’écran 2024-04-14 à 22 27 08

When choosing empty, this leads to following error:

Expected argument of type "string", "null" given at property path ...
Capture d’écran 2024-04-14 à 22 21 37

To Reproduce

  • Make an entity with a ChoiceField.
  • Make another entity with a ManyToOne relation CollectionField the the previous entity.
  • Write CRUD controller for both of them check previously detailed error.