mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-29 18:14:59 +00:00
Fix issue in PersonIdentifierDataMapper: find the PersonIdentifier against his definition
This commit is contained in:
@@ -279,7 +279,7 @@ final class PersonController extends AbstractController
|
|||||||
private function lastPostDataBuildHash(Form $form, Request $request): string
|
private function lastPostDataBuildHash(Form $form, Request $request): string
|
||||||
{
|
{
|
||||||
$fields = [];
|
$fields = [];
|
||||||
$ignoredFields = ['form_status', '_token'];
|
$ignoredFields = ['form_status', '_token', 'identifiers'];
|
||||||
|
|
||||||
foreach ($request->request->all()[$form->getName()] as $field => $value) {
|
foreach ($request->request->all()[$form->getName()] as $field => $value) {
|
||||||
if (\in_array($field, $ignoredFields, true)) {
|
if (\in_array($field, $ignoredFields, true)) {
|
||||||
|
@@ -39,7 +39,7 @@ final readonly class PersonIdentifiersDataMapper implements DataMapperInterface
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$form = $formsByKey['identifier_'.$worker->getDefinition()->getId()];
|
$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) {
|
if (null === $identifier) {
|
||||||
$identifier = new PersonIdentifier($worker->getDefinition());
|
$identifier = new PersonIdentifier($worker->getDefinition());
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ final readonly class PersonIdentifiersDataMapper implements DataMapperInterface
|
|||||||
|
|
||||||
foreach ($forms as $name => $form) {
|
foreach ($forms as $name => $form) {
|
||||||
$identifierId = (int) substr((string) $name, 11);
|
$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);
|
$definition = $this->identifierDefinitionRepository->find($identifierId);
|
||||||
if (null === $identifier) {
|
if (null === $identifier) {
|
||||||
$identifier = new PersonIdentifier($definition);
|
$identifier = new PersonIdentifier($definition);
|
||||||
|
Reference in New Issue
Block a user