Handle case where form is null in PersonIdentifiersDataMapper

- Added a null check for forms in `PersonIdentifiersDataMapper` to prevent potential errors: a form is not present at all steps (on creation / on edit)
- Skips processing if the form is not found.
This commit is contained in:
2025-10-07 11:29:45 +02:00
parent 6d8ef035ea
commit 8740025dbd
2 changed files with 7 additions and 2 deletions

View File

@@ -38,7 +38,12 @@ final readonly class PersonIdentifiersDataMapper implements DataMapperInterface
if (!$worker->getDefinition()->isEditableByUsers()) {
continue;
}
$form = $formsByKey['identifier_'.$worker->getDefinition()->getId()];
$form = $formsByKey['identifier_'.$worker->getDefinition()->getId()] ?? null;
if (null === $form) {
continue;
}
$identifier = $viewData->findFirst(fn (int $key, PersonIdentifier $identifier) => $worker->getDefinition() === $identifier->getDefinition());
if (null === $identifier) {
$identifier = new PersonIdentifier($worker->getDefinition());

View File

@@ -34,7 +34,7 @@ interface PersonIdentifierEngineInterface
public function isEmpty(PersonIdentifier $identifier): bool;
/**
* Return a list of @link{IdentifierViolationDTO} to generatie violation errors.
* Return a list of @see{IdentifierViolationDTO} to generatie violation errors.
*
* @return list<IdentifierViolationDTO>
*/