Skip to content

Commit f3bf826

Browse files
committed
feature #5005 Renamed precision option to scale (WouterJ)
This PR was merged into the 2.7 branch. Discussion ---------- Renamed precision option to scale | Q | A | --- | --- | Doc fix? | no | New docs? | yes (symfony/symfony#13717) | Applies to | 2.7+ | Fixed tickets | - Commits ------- 59ac3d5 Renamed precision option to scale
2 parents d083c46 + 59ac3d5 commit f3bf826

File tree

6 files changed

+38
-26
lines changed

6 files changed

+38
-26
lines changed

reference/forms/types/integer.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ integers. By default, all non-integer values (e.g. 6.78) will round down (e.g. 6
1616
| Rendered as | ``input`` ``number`` field |
1717
+-------------+-----------------------------------------------------------------------+
1818
| Options | - `grouping`_ |
19-
| | - `precision`_ |
19+
| | - `scale`_ |
2020
| | - `rounding_mode`_ |
2121
+-------------+-----------------------------------------------------------------------+
2222
| Inherited | - `data`_ |
@@ -42,7 +42,7 @@ Field Options
4242

4343
.. include:: /reference/forms/types/options/grouping.rst.inc
4444

45-
.. include:: /reference/forms/types/options/precision.rst.inc
45+
.. include:: /reference/forms/types/options/scale.rst.inc
4646

4747
rounding_mode
4848
~~~~~~~~~~~~~

reference/forms/types/money.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ how the input and output of the data is handled.
1717
| Options | - `currency`_ |
1818
| | - `divisor`_ |
1919
| | - `grouping`_ |
20-
| | - `precision`_ |
20+
| | - `scale`_ |
2121
+-------------+---------------------------------------------------------------------+
2222
| Inherited | - `data`_ |
2323
| options | - `disabled`_ |
@@ -73,14 +73,18 @@ be set back on your object.
7373

7474
.. include:: /reference/forms/types/options/grouping.rst.inc
7575

76-
precision
77-
~~~~~~~~~
76+
scale
77+
~~~~~
78+
79+
.. versionadded:: 2.7
80+
The ``scale`` option was introduced in Symfony 2.7. Prior to Symfony 2.7,
81+
it was known as ``precision``.
7882

7983
**type**: ``integer`` **default**: ``2``
8084

81-
For some reason, if you need some precision other than 2 decimal places,
85+
For some reason, if you need some scale other than 2 decimal places,
8286
you can modify this value. You probably won't need to do this unless,
83-
for example, you want to round to the nearest dollar (set the precision
87+
for example, you want to round to the nearest dollar (set the scale
8488
to ``0``).
8589

8690
Inherited Options

reference/forms/types/number.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ number Field Type
55
=================
66

77
Renders an input text field and specializes in handling number input. This
8-
type offers different options for the precision, rounding, and grouping that
9-
you want to use for your number.
8+
type offers different options for the scale, rounding and grouping that you
9+
want to use for your number.
1010

1111
+-------------+----------------------------------------------------------------------+
1212
| Rendered as | ``input`` ``text`` field |
1313
+-------------+----------------------------------------------------------------------+
1414
| Options | - `grouping`_ |
15-
| | - `precision`_ |
15+
| | - `scale`_ |
1616
| | - `rounding_mode`_ |
1717
+-------------+----------------------------------------------------------------------+
1818
| Inherited | - `data`_ |
@@ -38,14 +38,14 @@ Field Options
3838

3939
.. include:: /reference/forms/types/options/grouping.rst.inc
4040

41-
.. include:: /reference/forms/types/options/precision.rst.inc
41+
.. include:: /reference/forms/types/options/scale.rst.inc
4242

4343
rounding_mode
4444
~~~~~~~~~~~~~
4545

4646
**type**: ``integer`` **default**: ``NumberToLocalizedStringTransformer::ROUND_HALFUP``
4747

48-
If a submitted number needs to be rounded (based on the ``precision``
48+
If a submitted number needs to be rounded (based on the `scale`_
4949
option), you have several configurable options for that rounding. Each
5050
option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer`:
5151

reference/forms/types/options/precision.rst.inc

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
scale
2+
~~~~~
3+
4+
.. versionadded:: 2.7
5+
The ``scale`` option was introduced in Symfony 2.7. Prior to Symfony 2.7,
6+
it was known as ``precision``.
7+
8+
**type**: ``integer`` **default**: Locale-specific (usually around ``3``)
9+
10+
This specifies how many decimals will be allowed until the field rounds
11+
the submitted value (via ``rounding_mode``). For example, if ``scale`` is set
12+
to ``2``, a submitted value of ``20.123`` will be rounded to, for example,
13+
``20.12`` (depending on your `rounding_mode`_).

reference/forms/types/percent.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This field adds a percentage sign "``%``" after the input box.
1515
+-------------+-----------------------------------------------------------------------+
1616
| Rendered as | ``input`` ``text`` field |
1717
+-------------+-----------------------------------------------------------------------+
18-
| Options | - `precision`_ |
18+
| Options | - `scale`_ |
1919
| | - `type`_ |
2020
+-------------+-----------------------------------------------------------------------+
2121
| Inherited | - `data`_ |
@@ -39,13 +39,17 @@ This field adds a percentage sign "``%``" after the input box.
3939
Field Options
4040
-------------
4141

42-
precision
43-
~~~~~~~~~
42+
scale
43+
~~~~~
44+
45+
.. versionadded:: 2.7
46+
The ``scale`` option was introduced in Symfony 2.7. Prior to Symfony 2.7,
47+
it was known as ``precision``.
4448

4549
**type**: ``integer`` **default**: ``0``
4650

47-
By default, the input numbers are rounded. To allow for more decimal
48-
places, use this option.
51+
By default, the input numbers are rounded. To allow for more decimal places,
52+
use this option.
4953

5054
type
5155
~~~~

0 commit comments

Comments
 (0)