File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed
src/Resources/skeleton/validator Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change 44
55use Symfony\Component\Validator\Constraint;
66
7- /**
8- * @Annotation
9- *
10- * @Target({"PROPERTY", "METHOD", "ANNOTATION"})
11- */
127#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
138class <?= $class_name ?> extends Constraint
149{
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+ }
2021}
You can’t perform that action at this time.
0 commit comments