php-JiraCloud-RESTAPI
php-JiraCloud-RESTAPI copied to clipboard
How to convert ADF description to normal text/html?
Hi
First of all, great to see the package is updated for v3 and php8+. Works like a charm!
Therefore, the ADF is nice, but I am using the API to sync issue titles and descriptions and I can't get this html export to convert a AtlassianDocumentFormat to a Document, which the exportor is requiring.
if ($description instanceof AtlassianDocumentFormat) {
$doc = /* how to? */;
$exporter = new DocumentExporter($doc);
$description = $exporter->export();
}
I have tried this;
$doc = Document::load($description);
// or
$doc = Document::load((array) $description);
// or
$doc = Document::load($description->jsonSerialize());
but all with no luck.. I don't know.. can you help me out?
Regards, Bert
FYI; I able to convert it this way; but I can imagine it should be easier to achieve;
$doc = Document::load(['type' => $description->type[0], 'content' => json_decode(json_encode($description->content), true)]);
Hi @bertoost Thank you for reaching out to me. I'll investigate it this week. Thanks!