I have a Symfony product
entity mapped with Doctrine.
My column price is defined like that :
/**
* @ORMColumn(type="float", scale=2)
*/
private $price;
In PhpMyAdmin, on one of my products, i define the price to be 59.99. But when i display it in my template i can’t have the entire number and i have only 59.
I tried doing this :
{{ product.price|number_format(2) }}
but it displays 59.00.. the dump gives me the same thing.
Does anyone have an idea ?
2
Answers
I found the solution thanks to @AlexandreTranchant, my
product.price
getter was like thatso it allowed me to store only integer and not float/decimal number. Changed it to float and I have my entire decimal number.
Not sure why you loose the decimals but i prefer to use type decimal: