Skip to content

"When" Constraint -> Possibility to apply validations if expression(s) not matched (same way as if/else) #57370

@Methraen

Description

@Methraen

Description

It would be useful to be able to apply constraints when "When" expression is not matched, same way as an if/else.

Example

So we could pass from this:

#[Assert\When('this.getProduct()?.getNature()?.value !== "SESSION"', new Assert\IsNull())]
#[Assert\When('this.getProduct()?.getNature()?.value === "SESSION"', new Assert\NotNull())]

To that:

#[Assert\When('this.getProduct()?.getNature()?.value !== "SESSION"', new Assert\IsNull(), new Assert\NotNull())]

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