-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Added ConstraintViolation::getConstraint() #11657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* @internal Used by the validator engine. Should not be called by user | ||
* code. | ||
*/ | ||
public function setConstraint(Constraint $constraint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the BC promise, this can must be documented in the UPGRADE-2.6.md
file, mustn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and also in the Validator changelog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both updated.
ping @symfony/deciders |
|
||
* The internal method `setConstraint()` was added to | ||
`Symfony\Component\Validator\Context\ExecutionContextInterface`. With | ||
this method, the context is informed about constraint that is currently |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing "the" before constraint?
👍 |
@@ -73,11 +74,16 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface | |||
private $plural; | |||
|
|||
/** | |||
* @var Constraint|null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot be null according to the constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
I'm 👍 on this one, just address @Tobion comment |
👍 |
… (webmozart) This PR was merged into the 2.6-dev branch. Discussion ---------- [Validator] Added ConstraintViolation::getConstraint() | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #5050 | License | MIT | Doc PR | - This PR adds a `getConstraint()` method to the `ConstraintViolation` in order to access the constraint causing the violation. Related to #7276, #7273 and #9691. Commits ------- ce1d209 [Validator] Added ConstraintViolation::getConstraint()
This PR adds a
getConstraint()
method to theConstraintViolation
in order to access the constraint causing the violation.Related to #7276, #7273 and #9691.