$this->legacyErrorMessages =
$legacyErrorMessages;
$metadata =
$validator->
getMetadataFor(\Symfony\Component\Form\Form::
class);
// Register the form constraints in the validator programmatically.
// This functionality is required when using the Form component without
// the DIC, where the XML file is loaded automatically. Thus the following
// code must be kept synchronized with validation.xml
/* @var $metadata ClassMetadata */
$metadata->
addConstraint(new Form());
$metadata->
addConstraint(new Traverse(false
));
$this->validator =
$validator;
$this->formRenderer =
$formRenderer;
$this->translator =
$translator;
} public function loadTypeGuesser(): ?FormTypeGuesserInterface
{ return new ValidatorTypeGuesser($this->validator
);
}