8000 [Form] group_by does not works with callable string · Issue #15542 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Form] group_by does not works with callable string #15542
Closed
@satanasdiabolo

Description

@satanasdiabolo

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

      0