ConstraintValidatorFactory::getInstance

public ConstraintValidatorFactory::getInstance(Constraint $constraint)

Overrides ConstraintValidatorFactory::getInstance

File

core/lib/Drupal/Core/Validation/ConstraintValidatorFactory.php, line 26

Class

ConstraintValidatorFactory
Defines a constraint validator factory that works with container injection.

Namespace

Drupal\Core\Validation

Code

public function getInstance(Constraint $constraint) {
  $class_name = $constraint->validatedBy();

  if (!isset($this->validators[$class_name])) {
    $this->validators[$class_name] = $this->classResolver->getInstanceFromDefinition($class_name);
  }

  return $this->validators[$class_name];
}
doc_Drupal
2016-10-29 08:56:09
Comments
Leave a Comment

Please login to continue.