You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Valid constraint default group is no Default but null.
If we defined something like:
class User
{
#[Assert\NotBlank(groups: ['create'])]
#[Assert\Length(min: 4, groups: ['create'])]
protected$firstName;
#[Assert\NotBlank(groups: ['create'])]
protected$lastName;
#[Assert\Valid]
privateCollection$addresses;
}
class Address
{
#[Assert\NotBlank]
protected$street;
#[Assert\NotBlank]
#[Assert\Length(max: 5)]
protected$zipCode;
}
When we validate the User with the create validation groups, it also validate Address, because the Valid constraint define the validation groups to null instead of Default.
To have something that work as attended we must define Default in Valid constraint:
It appear that this behavior is attended because there is a test to check that the Valid default group is null instead of Default.
There is no info about that behavior in the documentation, and why this specific constraint do not have Default as default group. I don't know why null is the default value here, just pass some times to find why the behavior is not the attended one (expect Default group like others).
The
Valid
constraint default group is noDefault
butnull
.If we defined something like:
When we validate the
User
with thecreate
validation groups, it also validateAddress
, because theValid
constraint define the validation groups tonull
instead ofDefault
.To have something that work as attended we must define
Default
inValid
constraint:It appear that this behavior is attended because there is a test to check that the
Valid
default group isnull
instead ofDefault
.There is no info about that behavior in the documentation, and why this specific constraint do not have
Default
as default group. I don't know whynull
is the default value here, just pass some times to find why the behavior is not the attended one (expectDefault
group like others).Maybe @xabbuh you can help us about it (symfony/symfony#21111) ?
The text was updated successfully, but these errors were encountered: