Reorder write and flush operations in AuditEventDumper::dump for consistent stored object persistence.

- Moved `storedObjectManager->write` call before `entityManager->flush` to ensure data integrity.
This commit is contained in:
2026-03-05 13:50:03 +01:00
parent 92739182d1
commit cd104f10ac

View File

@@ -134,13 +134,13 @@ class AuditEventDumper
fclose($handle); fclose($handle);
$content = file_get_contents($tmpPath);
$this->storedObjectManager->write($storedObject, $content, 'text/csv');
// Persist stored object so that a valid identifier exists in DB // Persist stored object so that a valid identifier exists in DB
$storedObject->setStatus(StoredObject::STATUS_READY); $storedObject->setStatus(StoredObject::STATUS_READY);
$this->entityManager->flush(); $this->entityManager->flush();
$content = file_get_contents($tmpPath);
$this->storedObjectManager->write($storedObject, $content, 'text/csv');
// Remove temp file from disk // Remove temp file from disk
@unlink($tmpPath); @unlink($tmpPath);
} }