From 819d0a6c15795f5d88bcbd7c9d002709cff769d6 Mon Sep 17 00:00:00 2001 From: Sergey Yastrebov Date: Tue, 3 Apr 2018 15:15:11 +0300 Subject: [PATCH] rounding_mode for money type --- reference/forms/types/money.rst | 3 ++ reference/forms/types/number.rst | 29 +------------------ .../forms/types/options/rounding_mode.rst.inc | 22 ++++++++++++++ 3 files changed, 26 insertions(+), 28 deletions(-) create mode 100644 reference/forms/types/options/rounding_mode.rst.inc diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst index 3f6af5941ef..e3f7c59c907 100644 --- a/reference/forms/types/money.rst +++ b/reference/forms/types/money.rst @@ -17,6 +17,7 @@ how the input and output of the data is handled. | Options | - `currency`_ | | | - `divisor`_ | | | - `grouping`_ | +| | - `rounding_mode`_ | | | - `scale`_ | +-------------+---------------------------------------------------------------------+ | Overridden | - `compound`_ | @@ -79,6 +80,8 @@ be set back on your object. .. include:: /reference/forms/types/options/grouping.rst.inc +.. include:: /reference/forms/types/options/rounding_mode.rst.inc + scale ~~~~~ diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst index 843ef81e51e..17d52d97f4e 100644 --- a/reference/forms/types/number.rst +++ b/reference/forms/types/number.rst @@ -43,34 +43,7 @@ Field Options .. include:: /reference/forms/types/options/scale.rst.inc -rounding_mode -~~~~~~~~~~~~~ - -**type**: ``integer`` **default**: ``NumberToLocalizedStringTransformer::ROUND_HALF_UP`` - -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`: - -* ``NumberToLocalizedStringTransformer::ROUND_DOWN`` Round towards zero. - -* ``NumberToLocalizedStringTransformer::ROUND_FLOOR`` Round towards negative - infinity. - -* ``NumberToLocalizedStringTransformer::ROUND_UP`` Round away from zero. - -* ``NumberToLocalizedStringTransformer::ROUND_CEILING`` Round towards - positive infinity. - -* ``NumberToLocalizedStringTransformer::ROUND_HALF_DOWN`` Round towards the - "nearest neighbor". If both neighbors are equidistant, round down. - -* ``NumberToLocalizedStringTransformer::ROUND_HALF_EVEN`` Round towards the - "nearest neighbor". If both neighbors are equidistant, round towards the - even neighbor. - -* ``NumberToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the - "nearest neighbor". If both neighbors are equidistant, round up. +.. include:: /reference/forms/types/options/rounding_mode.rst.inc Overridden Options ------------------ diff --git a/reference/forms/types/options/rounding_mode.rst.inc b/reference/forms/types/options/rounding_mode.rst.inc new file mode 100644 index 00000000000..d24ed18c551 --- /dev/null +++ b/reference/forms/types/options/rounding_mode.rst.inc @@ -0,0 +1,22 @@ +rounding_mode +~~~~~~~~~~~~~ + +**type**: ``integer`` **default**: ``NumberToLocalizedStringTransformer::ROUND_HALF_UP`` + +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`: + +* ``NumberToLocalizedStringTransformer::ROUND_DOWN`` Round towards zero. + +* ``NumberToLocalizedStringTransformer::ROUND_FLOOR`` Round towards negative infinity. + +* ``NumberToLocalizedStringTransformer::ROUND_UP`` Round away from zero. + +* ``NumberToLocalizedStringTransformer::ROUND_CEILING`` Round towards positive infinity. + +* ``NumberToLocalizedStringTransformer::ROUND_HALF_DOWN`` Round towards the "nearest neighbor". If both neighbors are equidistant, round down. + +* ``NumberToLocalizedStringTransformer::ROUND_HALF_EVEN`` Round towards the "nearest neighbor". If both neighbors are equidistant, round towards the even neighbor. + +* ``NumberToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the "nearest neighbor". If both neighbors are equidistant, round up.