-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Labels
FeatureGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)Help wantedIssues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.Keep openValidator
Description
The issue #11586 could be solved by providing a valid()
method in the Expression constraint (as alias for $context->getValidator()->validate()
, but returning a boolean):
/**
* @Expression("valid(this.author) or valid(this.creator)", message="Author or creator must be valid!")
*/
Additionally, a "constraints" option could be added which allows to pass constraints that can be used within the expression:
/**
* @Expression(
* "valid(value, regex) or valid(value, threeOrMore)",
* message="Value must match regex or be greater than 3!",
* constraints={
* "regex" = @Regex("/here-is-my-regex/"),
* "threeOrMore" = @GreaterThan(3),
* }
* )
*/
Opinions?
jvasseur
Metadata
Metadata
Assignees
Labels
FeatureGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)Help wantedIssues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.Keep openValidator