I have form type with some data from entity.
There is a field that is required and it's is not in the form type.
This is the default validation constraint :
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$name_blank = new NotBlank();
$name_blank->message = "The name should not be blank";
$metadata->addPropertyConstraint('name', $name_blank);
}
Is there a way to override Symfony default validation?
public function checkRequiredDynamicFields(ExecutionContextInterface $context) {
$metadata = $context->getMetadata();
if (empty($this->name)) {
$context->buildViolation('This is a required field.')
->atPath('name')
->addViolation();
$context->buildViolation("Missing the title for conference section.")->addViolation();
}
}