You are here

public function ValidatorBuilder::setConstraintValidatorFactory in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/ValidatorBuilder.php \Symfony\Component\Validator\ValidatorBuilder::setConstraintValidatorFactory()

Sets the constraint validator factory used by the validator.

Parameters

ConstraintValidatorFactoryInterface $validatorFactory The validator factory:

Return value

ValidatorBuilderInterface The builder object

Overrides ValidatorBuilderInterface::setConstraintValidatorFactory

File

vendor/symfony/validator/ValidatorBuilder.php, line 264

Class

ValidatorBuilder
The default implementation of {@link ValidatorBuilderInterface}.

Namespace

Symfony\Component\Validator

Code

public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory) {
  if (null !== $this->propertyAccessor) {
    throw new ValidatorException('You cannot set a validator factory after setting a custom property accessor. Remove the call to setPropertyAccessor() if you want to call setConstraintValidatorFactory().');
  }
  $this->validatorFactory = $validatorFactory;
  return $this;
}