From 549d256f6c26b963ca13fa9070f166b37c3f93ea Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 11 Jan 2023 18:38:20 +0100 Subject: [PATCH] [Validator] Add `getConstraint()` method to `ConstraintViolationInterface` --- validation.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/validation.rst b/validation.rst index 5b9fbcb9ce8..6a4f5da69a1 100644 --- a/validation.rst +++ b/validation.rst @@ -212,7 +212,13 @@ Inside the template, you can output the list of errors exactly as needed: .. note:: Each validation error (called a "constraint violation"), is represented by - a :class:`Symfony\\Component\\Validator\\ConstraintViolation` object. + a :class:`Symfony\\Component\\Validator\\ConstraintViolation` object. This + object allows you, among other things, to get the constraint that caused this + violation thanks to the ``ConstraintViolation::getConstraint()`` method. + +.. versionadded:: 6.3 + + The ``ConstraintViolation::getConstraint()`` method was introduced in Symfony 6.3. .. index:: single: Validation; Callables