In db the field is type decimal and is saved like this 0.5
In Entity the field
/** @ORM\Column(name="precio_x_ticket", type="decimal", scale=2) */
In FormType the field is configure like this
->add('precio_x_ticket','money', array(
//'grouping' => true,
'currency' => false,
'label' => 'Precio por ticket',
))
When saving from the form I can save numbers like in this format 0.5 or 0,5 but after saving the number always return this format 0,5 and I wanted to show it like 0.5
My locale is es
Any idea how to solve this using just symfony2.5?
Since I was using
{{ form_start(formulario) }}
I needed to use{{ form_widget(formulario.precio_x_ticket, {'value': formulario.precio_x_ticket.vars.value|number_format(2, '.', ' ')}) }}
to show the value in #.## format.
You can use number_format anywhere You want to display a number in custom view. I would not suggest to change Your
locale
or do other system changes as it would produce unportable and system/configuration dependent code.