overridden typed validator honor validation value

This commit is contained in:
Yuri Kuznetsov
2025-09-30 12:56:30 +03:00
parent ec5bc2f6f2
commit 575a63b22c

View File

@@ -196,12 +196,6 @@ class FieldValidationManager
$data ??= (object) [];
$entityType = $entity->getEntityType();
$result = $this->processValidator($entity, $field, $type, new Data($data));
if (!$result) {
return false;
}
$validationValue = $value ?? $this->fieldUtil->getEntityTypeFieldParam($entityType, $field, $type);
$isMandatory = in_array($type, $this->getMandatoryValidationList($entityType, $field));
@@ -213,12 +207,19 @@ class FieldValidationManager
$validationValue = true;
}
$skip = !$isMandatory && (is_null($validationValue) || $validationValue === false);
if ($skip) {
if (
!$isMandatory &&
($validationValue === null || $validationValue === false)
) {
return true;
}
$result = $this->processTypeValidator($entity, $field, $type, new Data($data));
if (!$result) {
return false;
}
$result1 = $this->processFieldCheck($entityType, $type, $entity, $field, $validationValue);
if (!$result1) {
@@ -234,7 +235,7 @@ class FieldValidationManager
return true;
}
private function processValidator(Entity $entity, string $field, string $type, Data $data): bool
private function processTypeValidator(Entity $entity, string $field, string $type, Data $data): bool
{
$validator = $this->getValidator($entity->getEntityType(), $field, $type);