get('dokument'); if (!$dokument) { return; } if (is_object($dokument)) { $attachment = $dokument; } else { $attachment = $this->getEntityManager()->getEntity('Attachment', $dokument); } if (!$attachment) { return; } $filePath = 'data/upload/' . $attachment->get('id'); if (!file_exists($filePath)) { return; } // Berechne Blake3 Hash $fileContent = file_get_contents($filePath); if ($fileContent === false) { return; } $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'); } } } }