Skip to content

Using Expressions in Validation Constraints #21476

@Seb33300

Description

@Seb33300

Hi,

It seems to not be possible at this time.

Instead of using the @Assert\Expression constraint, sometimes, it could be great to support expressions directly in others constraints like:

/**
 * @Assert\Range(
 *      min = "this.startDate",
 *      max = "this.startDate + 10 days"
 * )
 */
 protected $endDate;

/**
 * @Assert\GreaterThan("this.startDate")
 */
protected $endDate;

// etc...

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