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.
2 parents d1fe7ab + a41bac9 commit bd56621Copy full SHA for bd56621
validation/custom_constraint.rst
@@ -245,3 +245,19 @@ not to the property:
245
<class name="App\Entity\AcmeEntity">
246
<constraint name="App\Validator\Constraints\ProtocolClass"/>
247
</class>
248
+
249
+ .. code-block:: php
250
251
+ // src/AppBundle/Entity/AcmeEntity.php
252
+ use AppBundle\Validator\Constraints\ProtocolClass;
253
+ use Symfony\Component\Validator\Mapping\ClassMetadata;
254
255
+ class AcmeEntity
256
+ {
257
+ // ...
258
259
+ public static function loadValidatorMetadata(ClassMetadata $metadata)
260
261
+ $metadata->addConstraint(new ProtocolClass());
262
+ }
263
0 commit comments