Skip to content

Commit 268e439

Browse files
committed
rounding_mode for money type
1 parent e192330 commit 268e439

File tree

3 files changed

+26
-28
lines changed

3 files changed

+26
-28
lines changed

reference/forms/types/money.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ how the input and output of the data is handled.
1818
| | - `divisor`_ |
1919
| | - `grouping`_ |
2020
| | - `scale`_ |
21+
| | - `rounding_mode`_ |
2122
+-------------+---------------------------------------------------------------------+
2223
| Overridden | - `compound`_ |
2324
| options | |
@@ -89,6 +90,8 @@ you can modify this value. You probably won't need to do this unless,
8990
for example, you want to round to the nearest dollar (set the scale
9091
to ``0``).
9192

93+
.. include:: /reference/forms/types/options/rounding_mode.rst.inc
94+
9295
Overridden Options
9396
------------------
9497

reference/forms/types/number.rst

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,7 @@ Field Options
4343

4444
.. include:: /reference/forms/types/options/scale.rst.inc
4545

46-
rounding_mode
47-
~~~~~~~~~~~~~
48-
49-
**type**: ``integer`` **default**: ``NumberToLocalizedStringTransformer::ROUND_HALF_UP``
50-
51-
If a submitted number needs to be rounded (based on the `scale`_
52-
option), you have several configurable options for that rounding. Each
53-
option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer`:
54-
55-
* ``NumberToLocalizedStringTransformer::ROUND_DOWN`` Round towards zero.
56-
57-
* ``NumberToLocalizedStringTransformer::ROUND_FLOOR`` Round towards negative
58-
infinity.
59-
60-
* ``NumberToLocalizedStringTransformer::ROUND_UP`` Round away from zero.
61-
62-
* ``NumberToLocalizedStringTransformer::ROUND_CEILING`` Round towards
63-
positive infinity.
64-
65-
* ``NumberToLocalizedStringTransformer::ROUND_HALF_DOWN`` Round towards the
66-
"nearest neighbor". If both neighbors are equidistant, round down.
67-
68-
* ``NumberToLocalizedStringTransformer::ROUND_HALF_EVEN`` Round towards the
69-
"nearest neighbor". If both neighbors are equidistant, round towards the
70-
even neighbor.
71-
72-
* ``NumberToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the
73-
"nearest neighbor". If both neighbors are equidistant, round up.
46+
.. include:: /reference/forms/types/options/rounding_mode.rst.inc
7447

7548
Overridden Options
7649
------------------
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
rounding_mode
2+
~~~~~~~~~~~~~
3+
4+
**type**: ``integer`` **default**: ``NumberToLocalizedStringTransformer::ROUND_HALF_UP``
5+
6+
If a submitted number needs to be rounded (based on the `scale`_
7+
option), you have several configurable options for that rounding. Each
8+
option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer`:
9+
10+
* ``NumberToLocalizedStringTransformer::ROUND_DOWN`` Round towards zero.
11+
12+
* ``NumberToLocalizedStringTransformer::ROUND_FLOOR`` Round towards negative infinity.
13+
14+
* ``NumberToLocalizedStringTransformer::ROUND_UP`` Round away from zero.
15+
16+
* ``NumberToLocalizedStringTransformer::ROUND_CEILING`` Round towards positive infinity.
17+
18+
* ``NumberToLocalizedStringTransformer::ROUND_HALF_DOWN`` Round towards the "nearest neighbor". If both neighbors are equidistant, round down.
19+
20+
* ``NumberToLocalizedStringTransformer::ROUND_HALF_EVEN`` Round towards the "nearest neighbor". If both neighbors are equidistant, round towards the even neighbor.
21+
22+
* ``NumberToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the "nearest neighbor". If both neighbors are equidistant, round up.

0 commit comments

Comments
 (0)