@@ -178,15 +178,15 @@ with the necessary ``validator.constraint_validator``. This means you can
178
178
Class Constraint Validator
179
179
~~~~~~~~~~~~~~~~~~~~~~~~~~
180
180
181
- Beside validating a class property, a constraint can have a class scope by
182
- providing a target in its ``Constraint `` class::
181
+ Besides validating a single property, a constraint can have an entire class
182
+ as its scope. Just add this to the ``Constraint `` class::
183
183
184
184
public function getTargets()
185
185
{
186
186
return self::CLASS_CONSTRAINT;
187
187
}
188
188
189
- With this, the validator ``validate() `` method gets an object as its first argument::
189
+ With this, the validator's ``validate() `` method gets an object as its first argument::
190
190
191
191
class ProtocolClassValidator extends ConstraintValidator
192
192
{
@@ -206,15 +206,15 @@ With this, the validator ``validate()`` method gets an object as its first argum
206
206
associated to. Use any :doc: `valid PropertyAccess syntax </components/property_access >`
207
207
to define that property.
208
208
209
- Note that a class constraint validator is applied to the class itself, and
209
+ A class constraint validator is applied to the class itself, and
210
210
not to the property:
211
211
212
212
.. configuration-block ::
213
213
214
214
.. code-block :: php-annotations
215
215
216
216
/**
217
- * @AcmeAssert\ProtocolClassValidator
217
+ * @AcmeAssert\ProtocolClass
218
218
*/
219
219
class AcmeEntity
220
220
{
@@ -226,11 +226,11 @@ not to the property:
226
226
# src/AppBundle/Resources/config/validation.yml
227
227
AppBundle\Entity\AcmeEntity :
228
228
constraints :
229
- - AppBundle\Validator\Constraints\ProtocolClassValidator : ~
229
+ - AppBundle\Validator\Constraints\ProtocolClass : ~
230
230
231
231
.. code-block :: xml
232
232
233
233
<!-- src/AppBundle/Resources/config/validation.xml -->
234
234
<class name =" AppBundle\Entity\AcmeEntity" >
235
- <constraint name =" AppBundle\Validator\Constraints\ProtocolClassValidator " />
235
+ <constraint name =" AppBundle\Validator\Constraints\ProtocolClass " />
236
236
</class >
0 commit comments