Skip to content

[Form] Removed Integer scale option #9542

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
12 changes: 8 additions & 4 deletions reference/forms/types/integer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ integers. By default, all non-integer values (e.g. 6.78) will round down
| Rendered as | ``input`` ``number`` field |
+-------------+-----------------------------------------------------------------------+
| Options | - `grouping`_ |
| | - `scale`_ |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO we should better move it to the Overridden section, saying that the reverse transformation cast the value to an integer, ignoring the scale option at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @HeahDude! Sorry for my late reply.
I'm not really convinced by the interest of keeping this point in the documentation if the user can not customize its behavior by any way. As any value that might have been set by the user to scale of IntegerType will be overridden by 0, it make sense for me to remove this section from its documentation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, but this option is defined anyway and the type can still be extended to customize the transformation process. I would prefer to document the option and its overridden behavior instead of not mentioning anything.

| | - `rounding_mode`_ |
+-------------+-----------------------------------------------------------------------+
| Overridden | - `compound`_ |
| options | |
| options | - `scale`_ |
+-------------+-----------------------------------------------------------------------+
| Inherited | - `data`_ |
| options | - `disabled`_ |
Expand All @@ -47,8 +46,6 @@ Field Options

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

.. include:: /reference/forms/types/options/scale.rst.inc

rounding_mode
~~~~~~~~~~~~~

Expand Down Expand Up @@ -83,6 +80,13 @@ Overridden Options

.. include:: /reference/forms/types/options/compound_type.rst.inc

scale
~~~~~

**type**: ``integer`` **default**: ``0``

This specifies how many decimals will be allowed until the field rounds the submitted value (via ``rounding_mode``). This option inherits from :doc:`number </reference/forms/types/number>` type and is overriden to ``0`` for ``IntegerType``.

Inherited Options
-----------------

Expand Down
14 changes: 13 additions & 1 deletion reference/forms/types/number.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,19 @@ Field Options

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

.. include:: /reference/forms/types/options/scale.rst.inc
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`_).

rounding_mode
~~~~~~~~~~~~~
Expand Down
13 changes: 0 additions & 13 deletions reference/forms/types/options/scale.rst.inc

This file was deleted.