Skip to content

Instantly share code, notes, and snippets.

@raulfraile raulfraile/gist:5827468
Last active Dec 18, 2015

What would you like to do?
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
class ContainsJavaValidator extends ConstraintValidator
public function validate($value, Constraint $constraint)
if (stripos($value, 'java') !== false) {
$this->context->addViolation($constraint->message, array('%string%' => $value));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.