Refactor validation handling in PersonEdit.vue: Replace hasValidationError and validationError with hasViolation and violationTitles. Introduce hasViolationWithParameter and violationTitlesWithParameter for enhanced field validation. Update RequiredIdentifierConstraint messages, improve API error mapping, and refine ValidationException structure with violationsList. Add tests and translations for identifier validation.

This commit is contained in:
2025-09-18 16:12:05 +02:00
parent 52404956d2
commit a5b06de92a
9 changed files with 92 additions and 44 deletions

View File

@@ -16,9 +16,10 @@ use Symfony\Component\Validator\Constraint;
/**
* Test that the required constraints are present.
*/
#[\Attribute]
class RequiredIdentifierConstraint extends Constraint
{
public string $message = 'This identifier must be set';
public string $message = 'person_identifier.This identifier must be set';
public function getTargets(): string
{

View File

@@ -45,7 +45,6 @@ final class RequiredIdentifierConstraintValidator extends ConstraintValidator
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $worker->renderAsString($identifier))
->setParameter('definition_id', (string) $worker->getDefinition()->getId())
->atPath('identifiers')
->setCode('c08b7b32-947f-11f0-8608-9b8560e9bf05')
->addViolation();
}