Problem/Motivation

Using default-content:export-references does not export comments.

Steps to reproduce

  1. Create a content type that allows comments
  2. Create a node of the type
  3. Place a comment on the node
  4. Export the node using drush dcer
  5. Notice that the comment is not automatically exported

Proposed resolution

Add support for comments.

Remaining tasks

  • Decide whether to treat comments as compound entities and export within the parent entity, or as stand-alone entities
  • Create a patch
  • Review
  • Commit

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

eelkeblok created an issue.

berdir’s picture

Comments are clearly standalone, and the node has no reference to comments, its comments that reference the parent node in a custom DER-like, two-field based reference. The comment field just stores the comment setting and I don't think it's a good match to embed them.

Supporting that lookup in either direction would require comment-specific logic. Open to that as I suspect right now, the comment parent reference isn't properly referenced.

berdir’s picture

this already seems to be half-working at least, entity_id does contain the entity UUID. not sure if there's anything to do here.

agentrickard’s picture

When working with forum comments at least, we get this error:

TypeError: Drupal\forum\ForumIndexStorage::updateIndex(): Argument #1 ($node) must be of type Drupal\node\NodeInterface, null given, called in /var/www/html/web/core/modules/forum/forum.module on line 287 in /var/www/html/web/core/modules/forum/src/ForumIndexStorage.php on line 93 #0 /var/www/html/web/core/modules/forum/forum.module(287): Drupal\forum\ForumIndexStorage->updateIndex(NULL)

That suggests that the entity_id mapping isn't loading properly.

berdir’s picture

What that probably means is that the reference is there, but not tracked as a dependency, so default_content doesn't know that it needs to create the node before the comments.