diff --git a/reference/forms/types/integer.rst b/reference/forms/types/integer.rst index edf9e9c1b9b..6a2fcdcadbe 100644 --- a/reference/forms/types/integer.rst +++ b/reference/forms/types/integer.rst @@ -16,7 +16,7 @@ integers. By default, all non-integer values (e.g. 6.78) will round down (e.g. 6 | Rendered as | ``input`` ``number`` field | +-------------+-----------------------------------------------------------------------+ | Options | - `grouping`_ | -| | - `precision`_ | +| | - `scale`_ | | | - `rounding_mode`_ | +-------------+-----------------------------------------------------------------------+ | Inherited | - `data`_ | @@ -42,7 +42,7 @@ Field Options .. include:: /reference/forms/types/options/grouping.rst.inc -.. include:: /reference/forms/types/options/precision.rst.inc +.. include:: /reference/forms/types/options/scale.rst.inc rounding_mode ~~~~~~~~~~~~~ diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst index 6db6ead9c06..ca89ab16f4a 100644 --- a/reference/forms/types/money.rst +++ b/reference/forms/types/money.rst @@ -17,7 +17,7 @@ how the input and output of the data is handled. | Options | - `currency`_ | | | - `divisor`_ | | | - `grouping`_ | -| | - `precision`_ | +| | - `scale`_ | +-------------+---------------------------------------------------------------------+ | Inherited | - `data`_ | | options | - `disabled`_ | @@ -73,14 +73,18 @@ be set back on your object. .. include:: /reference/forms/types/options/grouping.rst.inc -precision -~~~~~~~~~ +scale +~~~~~ + +.. versionadded:: 2.7 + The ``scale`` option was introduced in Symfony 2.7. Prior to Symfony 2.7, + it was known as ``precision``. **type**: ``integer`` **default**: ``2`` -For some reason, if you need some precision other than 2 decimal places, +For some reason, if you need some scale other than 2 decimal places, you can modify this value. You probably won't need to do this unless, -for example, you want to round to the nearest dollar (set the precision +for example, you want to round to the nearest dollar (set the scale to ``0``). Inherited Options diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst index 29f4edfaf2e..3f66fcc5386 100644 --- a/reference/forms/types/number.rst +++ b/reference/forms/types/number.rst @@ -5,14 +5,14 @@ number Field Type ================= Renders an input text field and specializes in handling number input. This -type offers different options for the precision, rounding, and grouping that -you want to use for your number. +type offers different options for the scale, rounding and grouping that you +want to use for your number. +-------------+----------------------------------------------------------------------+ | Rendered as | ``input`` ``text`` field | +-------------+----------------------------------------------------------------------+ | Options | - `grouping`_ | -| | - `precision`_ | +| | - `scale`_ | | | - `rounding_mode`_ | +-------------+----------------------------------------------------------------------+ | Inherited | - `data`_ | @@ -38,14 +38,14 @@ Field Options .. include:: /reference/forms/types/options/grouping.rst.inc -.. include:: /reference/forms/types/options/precision.rst.inc +.. include:: /reference/forms/types/options/scale.rst.inc rounding_mode ~~~~~~~~~~~~~ **type**: ``integer`` **default**: ``NumberToLocalizedStringTransformer::ROUND_HALFUP`` -If a submitted number needs to be rounded (based on the ``precision`` +If a submitted number needs to be rounded (based on the `scale`_ option), you have several configurable options for that rounding. Each option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer`: diff --git a/reference/forms/types/options/precision.rst.inc b/reference/forms/types/options/precision.rst.inc deleted file mode 100644 index ac606eb8a5d..00000000000 --- a/reference/forms/types/options/precision.rst.inc +++ /dev/null @@ -1,9 +0,0 @@ -precision -~~~~~~~~~ - -**type**: ``integer`` **default**: Locale-specific (usually around ``3``) - -This specifies how many decimals will be allowed until the field rounds -the submitted value (via ``rounding_mode``). For example, if ``precision`` -is set to ``2``, a submitted value of ``20.123`` will be rounded to, -for example, ``20.12`` (depending on your ``rounding_mode``). diff --git a/reference/forms/types/options/scale.rst.inc b/reference/forms/types/options/scale.rst.inc new file mode 100644 index 00000000000..82df7d60d3c --- /dev/null +++ b/reference/forms/types/options/scale.rst.inc @@ -0,0 +1,13 @@ +scale +~~~~~ + +.. versionadded:: 2.7 + The ``scale`` option was introduced in Symfony 2.7. Prior to Symfony 2.7, + it was known as ``precision``. + +**type**: ``integer`` **default**: Locale-specific (usually around ``3``) + +This specifies how many decimals will be allowed until the field rounds +the submitted value (via ``rounding_mode``). For example, if ``scale`` is set +to ``2``, a submitted value of ``20.123`` will be rounded to, for example, +``20.12`` (depending on your `rounding_mode`_). diff --git a/reference/forms/types/percent.rst b/reference/forms/types/percent.rst index 253a43c69b5..d0331523279 100644 --- a/reference/forms/types/percent.rst +++ b/reference/forms/types/percent.rst @@ -15,7 +15,7 @@ This field adds a percentage sign "``%``" after the input box. +-------------+-----------------------------------------------------------------------+ | Rendered as | ``input`` ``text`` field | +-------------+-----------------------------------------------------------------------+ -| Options | - `precision`_ | +| Options | - `scale`_ | | | - `type`_ | +-------------+-----------------------------------------------------------------------+ | Inherited | - `data`_ | @@ -39,13 +39,17 @@ This field adds a percentage sign "``%``" after the input box. Field Options ------------- -precision -~~~~~~~~~ +scale +~~~~~ + +.. versionadded:: 2.7 + The ``scale`` option was introduced in Symfony 2.7. Prior to Symfony 2.7, + it was known as ``precision``. **type**: ``integer`` **default**: ``0`` -By default, the input numbers are rounded. To allow for more decimal -places, use this option. +By default, the input numbers are rounded. To allow for more decimal places, +use this option. type ~~~~