SymfonyCasts / dynamic-forms

Add dynamic/dependent fields to Symfony forms
https://symfonycasts.com
MIT License
100 stars 10 forks source link

Data Transformers are ignored on form processing #31

Open parktrip opened 4 months ago

parktrip commented 4 months ago

Dear,

first thank you for this very nice bundle, it works perfectly. I just have a problem with Data Transformer, they are just completely ignored! I think the issue was reported in #17 but no solution was provided.

If I try to add the Model Transformer to a dependent field, it just says the field does not exist. If I try to attach it in the dependent field callback it doesn't work.

Is there any way to have model transformers working with dependent fields ?

Thank you in advance

Hricer commented 1 month ago

the same problem

j0r1s commented 3 weeks ago

I have provided a solution in this closed ticket

bocharsky-bw commented 3 weeks ago

Thanks for sharing the solution @j0r1s !

@parktrip @Hricer could you guys confirm it works for you too? If so, we could close this issue. Also, anyone is interested in creating a PR to improve the docs? We could mention the working example there if it will help others.

j0r1s commented 3 weeks ago

If this approach is confirmed as the best solution, I’d be happy to work on a PR to improve the documentation.

While creating a custom form type, even for a simple data transformer, may seem a bit cumbersome, it’s likely the cleanest approach in the end.

sadikoff commented 4 days ago

Hey @Hricer @parktrip a gentle ping are you still interested in fixing it, or that's already fixed for you?

Hricer commented 4 days ago

@j0r1s It's a good solution. Thanks for sharing. It works in my case.

parktrip commented 4 days ago

Hey @Hricer @parktrip a gentle ping are you still interested in fixing it, or that's already fixed for you?

sorry i didn't have the time to check the solution