Skip to content

[Validator] AtLeastOneOf Does not propagate groups #39386

@fvilpoix

Description

@fvilpoix

Symfony version(s) affected: 5.1.6

Description

When using the AtLeastOneOf constraint with custom validation groups, there are not provided to the sub constraints, it always looks for the Default group.

How to reproduce

So, if you have this kind of validation schema :

    myProperty:
       - AtLeastOneOf:
           groups: [myGroup]
           constraints:
               - Range:
                    min: 10
                    max: 20
                    groups: [myGroup]
               - Range:
                    min: 30
                    max: 40
                    groups: [myGroup]

And you validate your entity with myGroup, then it finds the AtLeastOneOf constraint, but not the two Range constraints, as the AtLeastOneOf looks for constraints matching the Default group.

To make it actually works, I have to set the Ranges' groups to [Default]

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions