Without a canonical link the export and therefore import of any entity with a paragraph attached to it fails.
I've done some work on https://www.drupal.org/node/2598138 to provide serialization/normalization support for entity reference revisions items but paragraphs still require a link to export.

I've made a patch with the startings of a paragraphs view url (ideas taken from node module). This is probably the totally wrong approach/ there is probably a much more suited way but for now this works...

Comments

zach.bimson created an issue. See original summary.

zach.bimson’s picture

StatusFileSize
new2.6 KB
zach.bimson’s picture

StatusFileSize
new2.6 KB

Removed stray }

zach.bimson’s picture

StatusFileSize
new2.59 KB

Remove white space

killua99’s picture

+++ b/src/Controller/ParagraphsPreviewController.php
@@ -0,0 +1,39 @@
+		die($paragraph);

Tab in here need to be removed.

Looks promising

berdir’s picture

There was initial effort to base the entity reference dependency calculation on the UUID. We should try to revive that, as that would reliably work for any entity type, unlike the URL.

Either that and/or fix rest/serialization in core to provide a default pseudo-URL (like entity/entity_type/ID) for entities without a canonical URL. What it does right now is just bogus and only works because it uses old, deprecated API's.

This is the wrong approach IMHO and will have weird side effects. Generic API's will try to link to paragraphs then, build corresponding routes and so on.

zach.bimson’s picture

Yeah i agree the wrong approach but i needed to get it working ASAP and thought id share/ get the conversation going on how to best fix this :)

berdir’s picture

We also found a second problem, and that's that saving apparently creates a new revision id and then the reference doesn't match anymore.

I'll ping @larowlan about this issue.

zach.bimson’s picture

Thanks for your help and input on this @berdir, be good to get this sorted.

larowlan’s picture

Can you provide some more detail about the saving/reference revision issue?
Do we need a ->setNewRevision(FALSE) or some-such on the paragraph?

larowlan’s picture

andypost’s picture

I used to export/import paragraphs without any issues, so no more fixes needed

cyberwolf’s picture

The problem mentioned by berdir in #8 still occurs. I think it needs fixing in Entity Reference Revisions, see #2780395: ERR fields are not deployable.

lammensj’s picture

StatusFileSize
new2.59 KB
new685 bytes

The patch in #4 could not be applied anymore due to a change in paragraphs.routing.yml.

miteshmap’s picture

StatusFileSize
new2.6 KB
miteshmap’s picture

StatusFileSize
new2.65 KB

Fixed file location and spacing errors.

berdir’s picture

Status: Active » Closed (won't fix)

This patch is not needed for default content and will not be committed like that.

Consider using #2848878: Embed Paragraph Content in Normalized Parent Entities (REST) instead, which allows to export a host entity including all its nested paragraphs.

eelkeblok’s picture

As I reported there as well, the combination of default content and that patch doesn't work too well. I think the problem lies in my use of dcer to export the content, which then also exports the paragraph. Subsequently importing both the content with the embedded paragraph as well as the seperate paragraph then fails with an integrity constaint volation.

eelkeblok’s picture

Sorry to re-open, but I think pointing to the ERR issue is a bit too quick. We've tried using that patch, but quickly run into problems when the target environment already has paragraphs and thus gets overlapping IDs. Not sure if ERR should not be exporting IDs, or whether default content should take action to not create overlapping IDs/ignore the IDs generated by the ERR normalization.

eelkeblok’s picture

Adding to the above: maybe it is an option to keep this open at least as long as #2848878: Embed Paragraph Content in Normalized Parent Entities (REST) hasn't been finalised to keep track of the effect on default content and guard the progress on getting this to properly work in DC? Maybe with status postponed?

berdir’s picture

Status: Active » Closed (duplicate)

That is how default_content works, there is an issue there to change that but until then, I think the patch should stay consistent with the current behavior of the module (you can also get into conflict on node ids).

And if we change it, we have to change it there, there's no point in keeping this open.