-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[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
Conversation
reference/forms/types/integer.rst
Outdated
@@ -47,37 +41,6 @@ Field Options | |||
|
|||
.. include:: /reference/forms/types/options/grouping.rst.inc | |||
|
|||
.. include:: /reference/forms/types/options/scale.rst.inc | |||
|
|||
rounding_mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that the rounding_mode
option is not used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, rounding_mode option is also hardcoded to ROUND_DOWN
for InterType
. (https://github.com/symfony/symfony/blob/a90cd13fa412a082bee8eda1bab2a5bcc8f18cb7/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php#L32)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's only the default value. But inside the form type's buildForm()
method the option is passed to the transformer and it will be used then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops! Yes you're right. Sorry for my mistake. I've updated the changes accordingly.
BTW, scale.rst.inc
file is now only included in number.rst
file, so shall we copy it's content directly to into number.rst
to remove the scale.rst.inc
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving the text makes sense to me.
Scale option is hardcoded for IntegerType. These changes result from the discussion introduced by symfony/symfony#26734.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dlabouesse for spotting and taking care of this issue. I've left a comment, please tell me what you think and wait for other reviews before making the change.
Ping @xabbuh
@@ -17,7 +17,6 @@ integers. By default, all non-integer values (e.g. 6.78) will round down | |||
| Rendered as | ``input`` ``number`` field | | |||
+-------------+-----------------------------------------------------------------------+ | |||
| Options | - `grouping`_ | | |||
| | - `scale`_ | |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@dlabouesse thanks a lot for taking care of improving the doc of this option. Thanks also for making all the changes suggested by reviewers (and thanks to them for the reviews!) Finally, congrats on your first Symfony Docs contribution! |
This PR was squashed before being merged into the 2.7 branch (closes #9542). Discussion ---------- [Form] Removed Integer scale option Scale option is hardcoded for IntegerType. These changes result from the discussion introduced by symfony/symfony#26734. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 2f61f75 [Form] Removed Integer scale option
Scale option is hardcoded for IntegerType.
These changes result from the discussion introduced by symfony/symfony#26734.