get('dokumentId'); if (!$dokumentId) { return; } // Verwende EntityManager zur korrekten Relation-Verwaltung $attachment = $this->entityManager->getEntityById('Attachment', $dokumentId); if (!$attachment) { return; } $filePath = 'data/upload/' . $attachment->getId(); if (!file_exists($filePath)) { return; } // Berechne Blake3 Hash $fileContent = file_get_contents($filePath); if ($fileContent === false) { return; } // Blake3 Hashing - schneller als SHA3 und kryptographisch sicher $newBlake3 = blake3($fileContent); // Setze Hash $entity->set('blake3hash', $newBlake3); // Bestimme Status if ($entity->isNew()) { $entity->set('fileStatus', 'new'); } else { $oldBlake3 = $entity->getFetched('blake3hash'); if ($oldBlake3 !== $newBlake3) { $entity->set('fileStatus', 'changed'); } else { $entity->set('fileStatus', 'synced'); } } } }