Skip to content

Commit

Permalink
[BUGFIX] Remove all additional entries from RecordIndex if there is m…
Browse files Browse the repository at this point in the history
…ore than one entry

Resolves: https://projekte.in2code.de/issues/67905

* The updated state (which is present in the DataHandler datamap) had been skipped in the subsequent call of the DataMapProcessor, because it was already in the index.
  • Loading branch information
tinzog committed Jan 8, 2025
1 parent ac2e797 commit 8b8d674
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Classes/Component/Core/RecordCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ public function addRecord(Record $record): void
$this->records[$record->getClassification()][$record->getId()] = $record;
}

public function removeRecordByTableAndIdentifier(string $table, int $identifier)
{
if (!empty($this->records[$table][$identifier])) {
unset($this->records[$table][$identifier]);
}
}

/**
* @param iterable<Record>|iterable<array<Record>> $records
*/
Expand Down
6 changes: 6 additions & 0 deletions Classes/Component/Core/RecordIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace In2code\In2publishCore\Component\Core;

use In2code\In2publish\Features\Workflow\AutoState\DatamapProcessor;
use In2code\In2publishCore\Component\Core\Record\Model\Record;

use function array_keys;
Expand All @@ -30,6 +31,11 @@ public function addRecord(Record $record): void
$this->records->addRecord($record);
}

public function removeRecordByTableAndIdentifier(string $table, int $identifier): void
{
$this->records->removeRecordByTableAndIdentifier($table, $identifier);
}

/**
* @return array<Record>
*/
Expand Down

0 comments on commit 8b8d674

Please sign in to comment.