Closed
Description
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.