public function ValidationVisitor::__construct in Plug 7
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
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ ValidationVisitor.php, line 80
Class
- ValidationVisitor
- Default implementation of {@link ValidationVisitorInterface} and {@link GlobalExecutionContextInterface}.
Namespace
Symfony\Component\ValidatorCode
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();
}