Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

rounding_mode for money type#9543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletionsreference/forms/types/money.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,6 +17,7 @@ how the input and output of the data is handled.
| Options | - `currency`_ |
| | - `divisor`_ |
| | - `grouping`_ |
| | - `rounding_mode`_ |
| | - `scale`_ |
+-------------+---------------------------------------------------------------------+
| Overridden | - `compound`_ |
Expand DownExpand Up@@ -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
~~~~~

Expand Down
29 changes: 1 addition & 28 deletionsreference/forms/types/number.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
------------------
Expand Down
22 changes: 22 additions & 0 deletionsreference/forms/types/options/rounding_mode.rst.inc
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
rounding_mode
~~~~~~~~~~~~~

**type**: ``integer`` **default**: ``NumberToLocalizedStringTransformer::ROUND_HALF_UP``

If a submitted number needs to berounded (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.

[8]ページ先頭

©2009-2025 Movatter.jp