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

Fix ResizeFormListener using integer keys #290

Merged
merged 1 commit into from
Nov 25, 2021

Conversation

franmomu
Copy link
Member

Subject

Ref sonata-project/SonataDoctrineMongoDBAdminBundle#699

In Symfony 6, Form::add method accepts FormInterface|string as first parameter.

When using CollectionType, the data is an array with integer keys and the FormResizerListener is using these keys to call Form:add.

// Then add all rows again in the correct order
foreach ($data as $name => $value) {
$options = array_merge($this->typeOptions, [
'property_path' => '['.$name.']',
'data' => $value,
]);
$form->add($name, $this->type, $options);
}

which means that it throws a TypeError.

I am targeting this branch, because this is BC.

Changelog

### Fixed
- Using `CollectionType` with Symfony 6

@franmomu franmomu added the patch label Nov 25, 2021
When using CollectionType, the data is an array with integer keys
and the expected type is FormInterface|string.
@jordisala1991 jordisala1991 merged commit 22472f2 into sonata-project:1.x Nov 25, 2021
@jordisala1991
Copy link
Member

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants