Skip to content

Commit 0815017

Browse files
committed
Merge branch '3.4' into 4.3
* 3.4: MoneyType: explain why the divisor option is useful
2 parents 12a8c2a + f0a0b55 commit 0815017

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

reference/forms/types/money.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ divisor
6969

7070
**type**: ``integer`` **default**: ``1``
7171

72-
If, for some reason, you need to divide your starting value by a number
72+
If you need to divide your starting value by a number
7373
before rendering it to the user, you can use the ``divisor`` option.
74-
For example::
74+
For example if you store prices as integer in order to avoid `rounding errors`_,
75+
you can transform values in cents automatically::
7576

7677
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
7778
// ...
@@ -159,3 +160,4 @@ money_pattern ``string`` The format to use to display the money, including the
159160
============= ========== ===============================================================
160161

161162
.. _`3 letter ISO 4217 code`: https://en.wikipedia.org/wiki/ISO_4217
163+
.. _`rounding errors`: https://0.30000000000000004.com/

0 commit comments

Comments
 (0)