Skip to content

fix(form): Error messages displayed twice with form type "sonata_type_native_collection" or "sonata_type_immutable_array" when "error_bubbling" sets to false#8335

Merged
VincentLanglet merged 1 commit into
sonata-project:4.xfrom
sad270:patch-1
Sep 9, 2025
Merged

Conversation

@sad270

@sad270 sad270 commented Sep 7, 2025

Copy link
Copy Markdown
Contributor

Subject

fix error messages displayed twice with form type "sonata_type_native_collection" or "sonata_type_immutable_array" when "error_bubbling" sets to false.

I am targeting this branch, because it's a fix.

Closes #2761

(related to #8208)

Step To Reproduce

  • Add an array property on an entity
  • Add Count constraints with min=2
  • On the Admin of this entity add Sonata\AdminBundle\Form\Type\CollectionType or Sonata\Form\Type\ImmutableArrayType field targeting this new property.
  • Add 'error_bubbling' => false form option on this field
  • Go to the creation form of this entity and try to submit.

Screenshot

Screenshot 2024-08-29 at 16 37 40

Changelog

### Fixed
- Error messages displayed twice with form type `sonata_type_native_collection` or `sonata_type_immutable_array` when `error_bubbling` sets to `false` #2761

The error is already displayed by form_row block.

I add some tests to ensure that the error message will be displayed, but I think it's not the best way as the FooAdmin form will not be able to be submit (it will always have validation errors)

…_native_collection" or "sonata_type_immutable_array" when "error_bubbling" sets to false

fix sonata-project#2761
# Conflicts:
#	src/Resources/views/Form/form_admin_fields.html.twig
@VincentLanglet VincentLanglet merged commit 8ee6c72 into sonata-project:4.x Sep 9, 2025
24 checks passed
@sad270 sad270 deleted the patch-1 branch September 9, 2025 22:24
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.

Error messages displayed twice with form type "sonata_type_native_collection" and "error_bubbling" sets to false

2 participants