Verified Commit 34e49ca8 authored by Alexis Ragot's avatar Alexis Ragot
Browse files

Fixed controller to return a binary data object

parent 962c1274
......@@ -269,7 +269,25 @@ trait archiveCommunicationTrait
throw $e;
}
return $digitalResource;
$binaryDataObject = \laabs::newInstance("recordsManagement/BinaryDataObject");
$binaryDataObject->attachment = new \stdClass();
$binaryDataObject->attachment->data = base64_encode($digitalResource->getContents());
$binaryDataObject->attachment->uri = "";
$binaryDataObject->attachment->filename = $digitalResource->fileName;
if (!empty($digitalResource->fileExtension)) {
$digitalResource->fileName = $digitalResource->fileName . $digitalResource->fileExtension;
}
$binaryDataObject->format = $digitalResource->puid;
$binaryDataObject->mimetype = $digitalResource->mimetype;
$binaryDataObject->size = $digitalResource->size;
$binaryDataObject->messageDigest = new \stdClass();
$binaryDataObject->messageDigest->value = $digitalResource->hash;
$binaryDataObject->messageDigest->algorithm = $digitalResource->hashAlgorithm;
return $binaryDataObject;
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment