We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5e04ff commit 00da788Copy full SHA for 00da788
validation/custom_constraint.rst
@@ -234,3 +234,19 @@ not to the property:
234
<class name="AppBundle\Entity\AcmeEntity">
235
<constraint name="AppBundle\Validator\Constraints\ProtocolClass"/>
236
</class>
237
+
238
+ .. code-block:: php
239
240
+ // src/AppBundle/Entity/AcmeEntity.php
241
+ use AppBundle\Validator\Constraints\ProtocolClass;
242
+ use Symfony\Component\Validator\Mapping\ClassMetadata;
243
244
+ class AcmeEntity
245
+ {
246
+ // ...
247
248
+ public static function loadValidatorMetadata(ClassMetadata $metadata)
249
250
+ $metadata->addConstraint(new ProtocolClass());
251
+ }
252
0 commit comments