-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
I'm struggling with a following issue: I'm working with a DataTransformer
and form based on array as a form model.
Form works well, of course. And I add a view transformer
$builder->get('field')->addViewTransformer(new MyTransformer());
If I submit a form, transformer works well:
$form->get('field')->getViewData();
And I get the transformed data correctly. But if I want to gather view data for whole form:
$form->getViewData();
It's synchronized with normalized data - transformed result is completely discarded. The, done some digging and found out that this code is enforcing data overwriting: https://github.com/symfony/form/blob/2.8/Form.php#L616
I'm using a stock mapper, PropertyPathMapper
.
Am I using something wrong or is this a bug? I'd like to get a view data for whole form, binding data transformer to a particular field. Right now, the only solution is to bind this to very whole builder.