Fix issue in PersonIdentifierDataMapper: find the PersonIdentifier against his definition

This commit is contained in:
2025-09-26 15:03:02 +02:00
parent ee006f55d6
commit be3b9f0f56
2 changed files with 3 additions and 3 deletions

View File

@@ -279,7 +279,7 @@ final class PersonController extends AbstractController
private function lastPostDataBuildHash(Form $form, Request $request): string
{
$fields = [];
$ignoredFields = ['form_status', '_token'];
$ignoredFields = ['form_status', '_token', 'identifiers'];
foreach ($request->request->all()[$form->getName()] as $field => $value) {
if (\in_array($field, $ignoredFields, true)) {

View File

@@ -39,7 +39,7 @@ final readonly class PersonIdentifiersDataMapper implements DataMapperInterface
continue;
}
$form = $formsByKey['identifier_'.$worker->getDefinition()->getId()];
$identifier = $viewData->findFirst(fn (int $key, PersonIdentifier $identifier) => $worker->getDefinition()->getId() === $identifier->getId());
$identifier = $viewData->findFirst(fn (int $key, PersonIdentifier $identifier) => $worker->getDefinition() === $identifier->getDefinition());
if (null === $identifier) {
$identifier = new PersonIdentifier($worker->getDefinition());
}
@@ -55,7 +55,7 @@ final readonly class PersonIdentifiersDataMapper implements DataMapperInterface
foreach ($forms as $name => $form) {
$identifierId = (int) substr((string) $name, 11);
$identifier = $viewData->findFirst(fn (int $key, PersonIdentifier $identifier) => $identifier->getId() === $identifierId);
$identifier = $viewData->findFirst(fn (int $key, PersonIdentifier $identifier) => $identifier->getDefinition()->getId() === $identifierId);
$definition = $this->identifierDefinitionRepository->find($identifierId);
if (null === $identifier) {
$identifier = new PersonIdentifier($definition);