Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Validator] All validation groups are not used on embedded constraints in a collection constraint #17675

Copy link
Copy link
Closed
@blazarecki

Description

@blazarecki
Issue body actions

Hi,

I don't know if it's a bug but it seem that all embedded constraints of a collection constraint are not applied when using validation groups.

I think that only the first validation group passed to the validator is used and the other are omitted.

With the following example if $config is equal to ['foo' => 'a'] then with validation groups:

  • ['foo', 'bar', 'baz'] we have 0 violation (NotBlank)
  • ['baz', 'bar', 'foo'] we have 1 violation (Lenght(min="4"))
  • ['bar', 'baz', 'foo'] we have 1 violation (Lenght(min="2"))
    /**
     * @Collection(
     *     fields={
     *          "foo" = {
     *              @NotBlank(groups={"foo"}),
     *              @Length(min="2", groups={"bar"}),
     *              @Length(min="4", groups={"baz"})
     *          }
     *     }
     * )
     */
    public $config;

Here the complete gist with the tests : https://gist.github.com/blazarecki/5dcb754be22dae4f0e53

Any idea ?
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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.