You are here

public function ValidationVisitor::__construct in Zircon Profile 8

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

Creates a new validation visitor.

Parameters

mixed $root The value passed to the validator.:

MetadataFactoryInterface $metadataFactory The factory for obtaining metadata instances.:

ConstraintValidatorFactoryInterface $validatorFactory The factory for creating constraint validators.:

TranslatorInterface $translator The translator for translating violation messages.:

string|null $translationDomain The domain of the translation messages.:

ObjectInitializerInterface[] $objectInitializers The initializers for preparing objects before validation.:

Throws

UnexpectedTypeException If any of the object initializers is not an instance of ObjectInitializerInterface

File

vendor/symfony/validator/ValidationVisitor.php, line 82

Class

ValidationVisitor
Default implementation of {@link ValidationVisitorInterface} and {@link GlobalExecutionContextInterface}.

Namespace

Symfony\Component\Validator

Code

public function __construct($root, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, TranslatorInterface $translator, $translationDomain = null, array $objectInitializers = array()) {
  foreach ($objectInitializers as $initializer) {
    if (!$initializer instanceof ObjectInitializerInterface) {
      throw new UnexpectedTypeException($initializer, 'Symfony\\Component\\Validator\\ObjectInitializerInterface');
    }
  }
  $this->root = $root;
  $this->metadataFactory = $metadataFactory;
  $this->validatorFactory = $validatorFactory;
  $this->translator = $translator;
  $this->translationDomain = $translationDomain;
  $this->objectInitializers = $objectInitializers;
  $this->violations = new ConstraintViolationList();
}