Skip to content

Commit 24947ae

Browse files
committed
Merge branch '3.4' into 4.2
* 3.4: Fixing error at Class Constraint Validator
2 parents 497e7a7 + fa9139b commit 24947ae

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

validation/custom_constraint.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,15 @@ with the necessary ``validator.constraint_validator``. This means you can
183183
Class Constraint Validator
184184
~~~~~~~~~~~~~~~~~~~~~~~~~~
185185

186-
Beside validating a class property, a constraint can have a class scope by
187-
providing a target in its ``Constraint`` class::
186+
Besides validating a single property, a constraint can have an entire class
187+
as its scope. You only need to add this to the ``Constraint`` class::
188188

189189
public function getTargets()
190190
{
191191
return self::CLASS_CONSTRAINT;
192192
}
193193

194-
With this, the validator ``validate()`` method gets an object as its first argument::
194+
With this, the validator's ``validate()`` method gets an object as its first argument::
195195

196196
class ProtocolClassValidator extends ConstraintValidator
197197
{
@@ -211,15 +211,15 @@ With this, the validator ``validate()`` method gets an object as its first argum
211211
associated to. Use any :doc:`valid PropertyAccess syntax </components/property_access>`
212212
to define that property.
213213

214-
Note that a class constraint validator is applied to the class itself, and
214+
A class constraint validator is applied to the class itself, and
215215
not to the property:
216216

217217
.. configuration-block::
218218

219219
.. code-block:: php-annotations
220220
221221
/**
222-
* @AcmeAssert\ProtocolClassValidator
222+
* @AcmeAssert\ProtocolClass
223223
*/
224224
class AcmeEntity
225225
{
@@ -231,11 +231,11 @@ not to the property:
231231
# config/validator/validation.yaml
232232
App\Entity\AcmeEntity:
233233
constraints:
234-
- App\Validator\Constraints\ProtocolClassValidator: ~
234+
- App\Validator\Constraints\ProtocolClass: ~
235235
236236
.. code-block:: xml
237237
238238
<!-- config/validator/validation.xml -->
239239
<class name="App\Entity\AcmeEntity">
240-
<constraint name="App\Validator\Constraints\ProtocolClassValidator"/>
240+
<constraint name="App\Validator\Constraints\ProtocolClass"/>
241241
</class>

0 commit comments

Comments
 (0)