Skip to content

ChoiceType group_by not honored after dependency change #53

@craigh

Description

@craigh

I have something like

            $builder->addDependent(
                'foo',
                'bar',
                function (DependentField $field, ?Bar $bar) {
                    if ($bar === 'blue') {
                        $field->add(EntityType::class, [
                            'class' => Baz::class,
                            'group_by' => function (Baz $baz) {
                                return $baz->isPublic() ? 'Public' : 'Private';
                            },
                            'choices' => $bar->getBazChoices(),
                            'choice_label' => 'name',
                        ]);
                    }
                }
            );

On the first load, the choices are grouped properly, but when the parent field changes and triggers change to the dependency, the group_by option is no longer honored.

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