Skip to content
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

Convert enum objects into scalar values during form submission #57

Merged
merged 4 commits into from
Aug 18, 2023

Conversation

yann-eugone
Copy link
Collaborator

When enum values are objects, the submitted data is the position of the value in the "choices" option.
It works but do not seems to be a good default value:

  • when working on a "MyCLabs enum", we want to submit the enum value
  • when working on a "PHP native enum", we want to submit the enum case name
  • when working on a "PHP native backed enum", we want to submit the enum case value

In order to avoid BC, the "enum_choice_value" option is introduced, and a deprecations is raised when it is not configured explicitely (forcing developer to think about the desired behavior).
But in the 5.x, the default behavior will be inverted, and the option will be true by default.

Copy link
Contributor

@J-Ben87 J-Ben87 left a comment

Choose a reason for hiding this comment

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

This might require a bit of documentation 🙂

@yann-eugone yann-eugone merged commit 323c155 into 4.x Aug 18, 2023
12 checks passed
@yann-eugone yann-eugone deleted the enum-form-submit-value branch July 8, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants