I have an application with a decimal field like:
/**
* @var decimal $amount
*
* @ORM\Column(name="amount", type="decimal", scale="2")
*/
private $amount;
I want that the form to accept numbers with a format like "3,4" or "3.4".
If I enter "3.4" the application save in the database "3.4", if I enter "3,4" the application saves in the database "34" (yes, without comma and without showing validation error!).
(This is a known symfony bug: https://github.com/symfony/symfony/issues/2059 )
So, how can i accept numbers with commas as well as decimal points?
(I already tried to substitute commas with dot in a DataTrasformer, but DataTransformer takes the number already normalized.)
I found a workaround using a DataTransformer with appendClientTransformer, here is the snippet: https://gist.github.com/3394880
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With