ExecutionContext::getValidator()

ValidatorInterface getValidator()

Returns the validator.

Useful if you want to validate additional constraints:

public function validate($value, Constraint $constraint)
{
    $validator = $this->context->getValidator();

    $violations = $validator->validateValue($value, new Length(array('min' => 3)));

    if (count($violations) > 0) {
        // ...
    }
}

Return Value

ValidatorInterface
doc_Symfony
2016-10-28 06:15:47
Comments
Leave a Comment

Please login to continue.