ContainsYamlValidator.php 637 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace WorkflowBundle\Validator\Constraints;
  3. use Symfony\Component\Validator\Constraint;
  4. use Symfony\Component\Validator\ConstraintValidator;
  5. use Symfony\Component\Yaml\Yaml;
  6. class ContainsYamlValidator extends ConstraintValidator
  7. {
  8. public function validate($value, Constraint $constraint)
  9. {
  10. $yaml = Yaml::dump($value,100,2);
  11. // if (!preg_match('/^[a-zA-Z0-9]+$/', $value, $matches)) {
  12. // $this->context->buildViolation($constraint->message)
  13. // ->setParameter('%string%', $value)
  14. // ->addViolation();
  15. // }
  16. }
  17. }