Skip to content

Commit bc07c02

Browse files
[Validator] Add getConstraint() method to ConstraintViolationInterface
1 parent 740e44f commit bc07c02

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::
220+
221+
The ``ConstraintViolation::getConstraint()`` method was introduced in Symfony 6.3.
216222

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

0 commit comments

Comments
 (0)