File tree 1 file changed +11
-10
lines changed
src/Resources/skeleton/validator
1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Symfony\Component\Validator\Constraint;
6
6
7
- /**
8
- * @Annotation
9
- *
10
- * @Target({"PROPERTY", "METHOD", "ANNOTATION"})
11
- */
12
7
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
13
8
class <?= $ class_name ?> extends Constraint
14
9
{
15
- /*
16
- * Any public properties become valid options for the annotation.
17
- * Then, use these in your validator class.
18
- */
19
- public string $message = 'The value "{{ value }}" is not valid.';
10
+ public string $message = 'The string "{{ string }}" contains an illegal character: it can only contain letters or numbers.';
11
+
12
+ // You can use #[HasNamedArguments] to make some constraint options required.
13
+ // All configurable options must be passed to the constructor.
14
+ public function __construct(
15
+ public string $mode = 'strict',
16
+ ?array $groups = null,
17
+ mixed $payload = null
18
+ ) {
19
+ parent::__construct([], $groups, $payload);
20
+ }
20
21
}
You can’t perform that action at this time.
0 commit comments