-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
Symfony version(s) affected: 4.3.3
Description
When the form is rendered after submission the submitted form data normally goes through a reverseTransform => transform cycle.
When a CollectionType field receives extra data and is configured with allow_add new fields are added for the extra data. However the data for those fields doesn't go trough the reverseTransform => transform cycle.
Motivation for wanting this is a ResolvedType which (usually) maps an id to a hidden id field and some resolved field. Think of an autocomplete field that returns in a hidden id field or an editable list where entries are displayed as markup but tagged with an id.
How to reproduce
- Create a form type FooType and use
addViewTransformerinbuildView - Create a form with a CollectionType field
- use
['entry_type' => FooType::class, 'allow_add' => true]as options - add a new field to the CollectionType list in the browser or using javascript
- When submitting and re-rendering the untransformed value will be shown
Here is code for an example.
https://gist.github.com/Tarmean/f8dbd3da7f74a26f491bca57038c87e6
I can create a full bug reproducer if needed but am not sure how symfony usually sets up the dependencies. This example comes from a legacy app with some symfony components added.