public function ExecutionContext::getValidator in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/validator/Context/ExecutionContext.php \Symfony\Component\Validator\Context\ExecutionContext::getValidator()
- 8 core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php \Drupal\Core\TypedData\Validation\ExecutionContext::getValidator()
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Context/ExecutionContext.php \Symfony\Component\Validator\Context\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
Overrides ExecutionContextInterface::getValidator
1 call to ExecutionContext::getValidator()
- ExecutionContext::getMetadataFactory in vendor/
symfony/ validator/ Context/ ExecutionContext.php - Returns the used metadata factory.
File
- vendor/
symfony/ validator/ Context/ ExecutionContext.php, line 247
Class
- ExecutionContext
- The context used and created by {@link ExecutionContextFactory}.
Namespace
Symfony\Component\Validator\ContextCode
public function getValidator() {
return $this->validator;
}