File tree 1 file changed +4
-7
lines changed
Filter options
1 file changed +4
-7
lines changed
Original file line number Diff line number Diff line change @@ -44,19 +44,16 @@ First you need to create a Constraint class and extend :class:`Symfony\\Componen
44
44
public $message = 'The string "{{ string }}" contains an illegal character: it can only contain letters or numbers.';
45
45
}
46
46
47
+ Add ``@Annotation `` or ``#[\Attribute] `` to the constraint class if you want to
48
+ use it as an annotation/attribute in other classes. If the constraint has
49
+ configuration options, define them as public properties on the constraint class.
50
+
47
51
.. versionadded :: 5.2
48
52
49
53
The ability to use PHP attributes to configure constraints was introduced in
50
54
Symfony 5.2. Prior to this, Doctrine Annotations were the only way to
51
55
annotate constraints.
52
56
53
- .. note ::
54
-
55
- The ``@Annotation `` annotation is necessary for this new constraint in
56
- order to make it available for use in classes via annotations.
57
- Options for your constraint are represented as public properties on the
58
- constraint class.
59
-
60
57
Creating the Validator itself
61
58
-----------------------------
62
59
You can’t perform that action at this time.
0 commit comments