ExecutionContext::getValidator

public ExecutionContext::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

Overrides ExecutionContextInterface::getValidator

File

core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php, line 186

Class

ExecutionContext
Defines an execution context class.

Namespace

Drupal\Core\TypedData\Validation

Code

public function getValidator() {
  return $this->validator;
}
doc_Drupal
2016-10-29 09:09:30
Comments
Leave a Comment

Please login to continue.