Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Form] group_by does not works with callable string #15542

Copy link
Copy link
Closed
@satanasdiabolo

Description

@satanasdiabolo
Issue body actions

I tried to use 'group_by' option with a call to a static method.

$form = $this->createFormBuilder()
            ->add('files', 'choice', [
                'choices' => [/* Some Choices */],
                'choices_as_values' => true,
                'group_by' => 'MyStatic::method'
            ])
            ->getForm();

Here is a dummy code sample of what I'm doing.
I saw in Symfony\Component\Form\ChoiceList\Factory\PropertyAccessDecorator::createView line 203, the test is if (is_string($groupBy)).
I think it should be if (is_string($groupBy) && !is_callable($groupBy)).

I have test with option choice_value, and other new options, but this bug may exists for those ones too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.