Skip to content

Commit ec4cbbb

Browse files
committed
feature symfony#17721 [Validator] Add getConstraint() method to ConstraintViolationInterface (alexandre-daubois)
This PR was merged into the 6.3 branch. Discussion ---------- [Validator] Add `getConstraint()` method to `ConstraintViolationInterface` Closes symfony#17610 Commits ------- 549d256 [Validator] Add `getConstraint()` method to `ConstraintViolationInterface`
2 parents 082a47a + 549d256 commit ec4cbbb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

validation.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,13 @@ Inside the template, you can output the list of errors exactly as needed:
212212
.. note::
213213

214214
Each validation error (called a "constraint violation"), is represented by
215-
a :class:`Symfony\\Component\\Validator\\ConstraintViolation` object.
215+
a :class:`Symfony\\Component\\Validator\\ConstraintViolation` object. This
216+
object allows you, among other things, to get the constraint that caused this
217+
violation thanks to the ``ConstraintViolation::getConstraint()`` method.
218+
219+
.. versionadded:: 6.3
220+
221+
The ``ConstraintViolation::getConstraint()`` method was introduced in Symfony 6.3.
216222

217223
.. index::
218224
single: Validation; Callables

0 commit comments

Comments
 (0)