You are here

public function ExecutionContextInterface::getValidator in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Context/ExecutionContextInterface.php \Symfony\Component\Validator\Context\ExecutionContextInterface::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

2 methods override ExecutionContextInterface::getValidator()
ExecutionContext::getValidator in vendor/symfony/validator/Context/ExecutionContext.php
Returns the validator.
ExecutionContext::getValidator in core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php
Returns the validator.

File

vendor/symfony/validator/Context/ExecutionContextInterface.php, line 102

Class

ExecutionContextInterface
The context of a validation run.

Namespace

Symfony\Component\Validator\Context

Code

public function getValidator();