@@ -183,15 +183,15 @@ with the necessary ``validator.constraint_validator``. This means you can
183
183
Class Constraint Validator
184
184
~~~~~~~~~~~~~~~~~~~~~~~~~~
185
185
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::
188
188
189
189
public function getTargets()
190
190
{
191
191
return self::CLASS_CONSTRAINT;
192
192
}
193
193
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::
195
195
196
196
class ProtocolClassValidator extends ConstraintValidator
197
197
{
@@ -211,15 +211,15 @@ With this, the validator ``validate()`` method gets an object as its first argum
211
211
associated to. Use any :doc: `valid PropertyAccess syntax </components/property_access >`
212
212
to define that property.
213
213
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
215
215
not to the property:
216
216
217
217
.. configuration-block ::
218
218
219
219
.. code-block :: php-annotations
220
220
221
221
/**
222
- * @AcmeAssert\ProtocolClassValidator
222
+ * @AcmeAssert\ProtocolClass
223
223
*/
224
224
class AcmeEntity
225
225
{
@@ -231,11 +231,11 @@ not to the property:
231
231
# config/validator/validation.yaml
232
232
App\Entity\AcmeEntity :
233
233
constraints :
234
- - App\Validator\Constraints\ProtocolClassValidator : ~
234
+ - App\Validator\Constraints\ProtocolClass : ~
235
235
236
236
.. code-block :: xml
237
237
238
238
<!-- config/validator/validation.xml -->
239
239
<class name =" App\Entity\AcmeEntity" >
240
- <constraint name =" App\Validator\Constraints\ProtocolClassValidator " />
240
+ <constraint name =" App\Validator\Constraints\ProtocolClass " />
241
241
</class >
0 commit comments