Skip to content

[Form] Minor reword in the Choice type #12054

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

Merged
merged 1 commit into from
Aug 8, 2019

Conversation

javiereguiluz
Copy link
Member

This will hopefully avoid issues like #11925.

@xabbuh
Copy link
Member

xabbuh commented Jul 29, 2019

Reading the related issue it occurs to me that the reporter was referring to options of the DateIntervalType. Maybe we need to add a sentence like there too.

@javiereguiluz
Copy link
Member Author

I've added more examples in the DateIntervalType docs. Thanks!

Copy link

@ovgray ovgray left a comment

Choose a reason for hiding this comment

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

The comments at lines 86, 119, 172, 187, 214 and 331 of the changed dateinterval.rst file are incorrect.

The comment at line 86 should say "values displayed to users range from 0 to 30 (both inclusive)". The other comments also misstate what the end of the displayed range would be.

The fact that these errors were made in trying to clarify this "feature" only illustrates how unintuitive the feature is.

@javiereguiluz
Copy link
Member Author

I tested in the Symfony Demo app:

->add('foo', DateIntervalType::class, [
    'mapped' => false,
])

image

->add('foo', DateIntervalType::class, [
    'mapped' => false,
    'months' => range(1, 12),
])

image

->add('foo', DateIntervalType::class, [
    'mapped' => false,
    'months' => array_combine(range(1, 12), range(1, 12)),
])

image

@ovgray
Copy link

ovgray commented Jul 30, 2019

Your test proves my point about the comment at line 186 (not 187 as my first comment said) of dateinterval.rst.

The values displayed to users when ‘months’ is set to range(1, 12) range from 0 to 11, not 0 to 12 as your comment says.

BTW, the same sort of error appears in line 200 as well.

@javiereguiluz
Copy link
Member Author

@adrx you are right! I was looking at the wrong comments! Sorry.

@javiereguiluz javiereguiluz merged commit e76a409 into symfony:3.4 Aug 8, 2019
javiereguiluz added a commit that referenced this pull request Aug 8, 2019
This PR was squashed before being merged into the 3.4 branch (closes #12054).

Discussion
----------

[Form] Minor reword in the Choice type

This will hopefully avoid issues like #11925.

Commits
-------

e76a409 [Form] Minor reword in the Choice type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants