Skip to content

[Form] Adding callable to choices #21003

New issue

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

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: 6.4
Choose a base branch
from

Conversation

ThomasLandauer
Copy link
Contributor

Page: https://symfony.com/doc/6.4/reference/forms/types/choice.html#choices

Passing something like MyEnum::myChoices() to an EnumType works, so I guess it could be added here.

Secondly: The entire choices option is missing at https://symfony.com/doc/current/reference/forms/types/enum.html but IMO this is a viable alternative to choice_filter to limit the choices to only some of the enum's cases.

Page: https://symfony.com/doc/6.4/reference/forms/types/choice.html#choices

Passing something like `MyEnum::myChoices()` to an `EnumType` works, so I guess it could be added here.

Secondly: The entire `choices` option is missing at https://symfony.com/doc/current/reference/forms/types/enum.html but IMO this is a viable alternative to `choice_filter` to limit the choices to only *some* of the enum's cases.
@ThomasLandauer ThomasLandauer requested a review from xabbuh as a code owner May 26, 2025 11:41
@carsonbot carsonbot added this to the 6.4 milestone May 26, 2025
@carsonbot carsonbot changed the title [Form]: Adding callable to choices [Form] : Adding callable to choices May 26, 2025
@OskarStark OskarStark changed the title [Form] : Adding callable to choices [Form] Adding callable to choices May 26, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants