public function ConstraintValidatorFactory::getInstance in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/validator/ConstraintValidatorFactory.php \Symfony\Component\Validator\ConstraintValidatorFactory::getInstance()
- 8 core/lib/Drupal/Core/Validation/ConstraintValidatorFactory.php \Drupal\Core\Validation\ConstraintValidatorFactory::getInstance()
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/ConstraintValidatorFactory.php \Symfony\Component\Validator\ConstraintValidatorFactory::getInstance()
Given a Constraint, this returns the ConstraintValidatorInterface object that should be used to verify its validity.
Parameters
Constraint $constraint The source constraint:
Return value
Overrides ConstraintValidatorFactoryInterface::getInstance
1 method overrides ConstraintValidatorFactory::getInstance()
- ConstraintValidatorFactory::getInstance in core/
lib/ Drupal/ Core/ Validation/ ConstraintValidatorFactory.php - Given a Constraint, this returns the ConstraintValidatorInterface object that should be used to verify its validity.
File
- vendor/
symfony/ validator/ ConstraintValidatorFactory.php, line 39
Class
- ConstraintValidatorFactory
- Default implementation of the ConstraintValidatorFactoryInterface.
Namespace
Symfony\Component\ValidatorCode
public function getInstance(Constraint $constraint) {
$className = $constraint
->validatedBy();
if (!isset($this->validators[$className])) {
$this->validators[$className] = 'validator.expression' === $className ? new ExpressionValidator($this->propertyAccessor) : new $className();
}
return $this->validators[$className];
}