Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to convert ADF description to normal text/html? #53

Open
bertoost opened this issue Apr 6, 2023 · 2 comments
Open

How to convert ADF description to normal text/html? #53

bertoost opened this issue Apr 6, 2023 · 2 comments

Comments

@bertoost
Copy link

bertoost commented Apr 6, 2023

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

@bertoost
Copy link
Author

bertoost commented Apr 6, 2023

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)]);

@lesstif
Copy link
Owner

lesstif commented Apr 16, 2023

Hi @bertoost Thank you for reaching out to me.
I'll investigate it this week.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants