Skip to content

Commit 47954fe

Browse files
committed
rounding_mode for money type
1 parent e192330 commit 47954fe

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
@@ -16,6 +16,7 @@ how the input and output of the data is handled.
1616
+-------------+---------------------------------------------------------------------+
1717
| Options | - `currency`_ |
1818
| | - `divisor`_ |
19+
| | - `rounding_mode`_ |
1920
| | - `grouping`_ |
2021
| | - `scale`_ |
2122
+-------------+---------------------------------------------------------------------+
@@ -77,6 +78,8 @@ In this case, if the ``price`` field is set to ``9900``, then the value
7778
value ``99``, it will be multiplied by ``100`` and ``9900`` will ultimately
7879
be set back on your object.
7980

81+
.. include:: /reference/forms/types/options/rounding_mode.rst.inc
82+
8083
.. include:: /reference/forms/types/options/grouping.rst.inc
8184

8285
scale

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy