mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-08 14:29:42 +00:00
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:
@@ -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());
|
||||
|
@@ -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>
|
||||
*/
|
||||
|
Reference in New Issue
Block a user