Skip to content

[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

Merged
merged 1 commit into from
Aug 19, 2014

Conversation

webmozart
Copy link
Contributor

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.

* @internal Used by the validator engine. Should not be called by user
* code.
*/
public function setConstraint(Constraint $constraint);
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks.

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both updated.

@webmozart
Copy link
Contributor Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "the" before constraint?

@stof
Copy link
Member

stof commented Aug 18, 2014

👍

@@ -73,11 +74,16 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface
private $plural;

/**
* @var Constraint|null
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@romainneutron
Copy link
Contributor

I'm 👍 on this one, just address @Tobion comment

@Tobion
Copy link
Contributor

Tobion commented Aug 19, 2014

👍

@webmozart webmozart merged commit ce1d209 into symfony:master Aug 19, 2014
webmozart added a commit that referenced this pull request Aug 19, 2014
… (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()
@webmozart webmozart deleted the violation-get-constraint branch September 11, 2014 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants