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 4f26e13 + 07c3fdf commit 400ef54Copy full SHA for 400ef54
validation/custom_constraint.rst
@@ -240,3 +240,19 @@ not to the property:
240
<class name="App\Entity\AcmeEntity">
241
<constraint name="App\Validator\Constraints\ProtocolClass"/>
242
</class>
243
+
244
+ .. code-block:: php
245
246
+ // src/Entity/AcmeEntity.php
247
+ use App\Validator\Constraints\ProtocolClass;
248
+ use Symfony\Component\Validator\Mapping\ClassMetadata;
249
250
+ class AcmeEntity
251
+ {
252
+ // ...
253
254
+ public static function loadValidatorMetadata(ClassMetadata $metadata)
255
256
+ $metadata->addConstraint(new ProtocolClass());
257
+ }
258
0 commit comments