Closed khaledelmahdi closed 9 years ago
No your money value should be an integer.
I am going to rewrite this package to get rid of the Value Objects, but for now your best is to turn your decimals into integers.
Don't store money values as decimals. It leads to rounding errors.
I am not sure how it should be integer?
If I am selling something cost £10.20 how I can charge the client £10 or £11? From accounting point of view this is wrong.
You work with monetary values in the smallest unit. So £10.20 would be stored in your database as 1020 (as in 1020p). You only convert back to 10.20 when you need to display it.
This prevents the rounding error of floats, see http://culttt.com/2014/05/28/handle-money-currency-web-applications/
In either case, I'm going to remove the restriction on this package very soon.
This has been resolved in v3.0
Cant add decimal value in money field.
Money.php line 19 need to be changed:
Assertion::integer($value);