You are here

public function ValidatorBuilder::setConstraintValidatorFactory in Plug 7

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

lib/Symfony/validator/Symfony/Component/Validator/ValidatorBuilder.php, line 272

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;
}