| @@ 10-27 (lines=18) @@ | ||
| 7 | use Symfony\Component\Validator\Constraint; |
|
| 8 | use Symfony\Component\Validator\ConstraintValidator; |
|
| 9 | ||
| 10 | class ValidParameterNameValidator extends ConstraintValidator |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * @inheritDoc |
|
| 14 | * @param ValidParameterName $constraint |
|
| 15 | */ |
|
| 16 | public function validate($value, Constraint $constraint) |
|
| 17 | { |
|
| 18 | if ($value !== $constraint->id) { |
|
| 19 | $this |
|
| 20 | ->context |
|
| 21 | ->buildViolation($constraint->message) |
|
| 22 | ->setParameter('{{ id }}', $constraint->id) |
|
| 23 | ->setParameter('{{ name }}', $value) |
|
| 24 | ->addViolation(); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | } |
|
| 28 | ||
| @@ 10-27 (lines=18) @@ | ||
| 7 | use Symfony\Component\Validator\Constraint; |
|
| 8 | use Symfony\Component\Validator\ConstraintValidator; |
|
| 9 | ||
| 10 | class ValidTypeNameValidator extends ConstraintValidator |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * @inheritDoc |
|
| 14 | * @param ValidTypeName $constraint |
|
| 15 | */ |
|
| 16 | public function validate($value, Constraint $constraint) |
|
| 17 | { |
|
| 18 | if ($value !== $constraint->id) { |
|
| 19 | $this |
|
| 20 | ->context |
|
| 21 | ->buildViolation($constraint->message) |
|
| 22 | ->setParameter('{{ id }}', $constraint->id) |
|
| 23 | ->setParameter('{{ name }}', $value) |
|
| 24 | ->addViolation(); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | } |
|
| 28 | ||