As a split-off from #2756417: Integration with the Paragraphs module, add support for Multiversion to Paragraphs, ultimately so that paragraph entities can be used with the Deploy module suite.


DamienMcKenna created an issue. See original summary.

DamienMcKenna’s picture

This is jeqq's patch from comment 24 in #2756417 separated out.

DamienMcKenna’s picture

Title: Add Multiversion support » Add Multiversion support to Paragraphs
DamienMcKenna’s picture

miro_dietiker’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

I didn't check multiversion in detail, but agree that we should greatly integrate with nice staging workflows.

To unblock this issue, please help work on test coverage.
It also helps me to review the situation as i can see the exact process we try to cover.

Grimreaper’s picture


I have tested the patch with the entity reference revisions patch from #2674882-12: Add Multiversion compatibility to Entity Reference Revisions (for Paragraphs, etc) and it does not work.

I have a few questions on the patch:

  1. +++ b/paragraphs.module
    @@ -210,3 +210,43 @@ function template_preprocess_paragraph(&$variables) {
    +        // Make all content entity types revisionable.

    I don't understand why the patch needs to affect all content entity types.

  2. +++ b/paragraphs.module
    @@ -210,3 +210,43 @@ function template_preprocess_paragraph(&$variables) {
    +        switch ($entity_type->id()) {
    +          case 'paragraph':

    Should this check on paragraph entity type must be done before?

vflirt’s picture

I have made a minor change in the patch as it seems to be just copied over from the linked issue. The paragraph supports revision so the lines for the checks are removed.
Also the patched introduced a hidden dependency on entity_storage_migrate so I wrapped the storage_schema in a module exists check.
I have not touched any of the other code. I have tested and this seems to work, I got my node with the paragraphs transferred with deploy.
There is one other thing that needs work on: once the paragraphs got transferred then the workspace started showing conflict and when I try to view the conflict I got :
Error: Call to undefined method Drupal\paragraphs\Entity\Paragraph::getChangedTime() in Drupal\workspace\Controller\Component\ConflictListBuilder->buildRow() (line 158 of modules/contrib/workspace/src/Controller/Component/ConflictListBuilder.php).
Not sure if a 'changed' field should be added to paragraphs content type.

In order to make the deploy worked I had to update the "multiversion.setting" enabled_entity_types and add paragraph, then had to clear cache so multiversion could add the database fields and all to work out. I tried to use the multiversion drush command to enable paragraph but it failed with sql error that the needed database columns did not exist.

akoe’s picture

Tested the patch in combination with successfully.

Besides that i faced the same error Error: Call to undefined method Drupal\paragraphs\Entity\Paragraph::getChangedTime() in the conflicts list.
Paragraphs intentionally removed its 'changed' field from Paragraph entities ( and relies on the node change property. So im unsure what a solution would be:
* either adding an exception in the ConflictListBuilder for Paragraph entities, which wouldn't be in the line with the whole entity idea in my eyes or
* adding a method to Paragraph entity, which would be just a wrapper for the nodes 'changed' property.

miro_dietiker’s picture

Hm.. We should be clean here, it means somehow, someone is blindly relying on Paragraphs implementing EntityChangedInterface.

Plz add the method and check the stacktrace and figure out why this is called.
We might need to add that implementation to make us compatible with Multiversion. And we might want to implement this as a plain wrapper to the host changed method, because we introduce the host concept.
But the current caller should only try to call this method if the object implements EntityChangedInterface, thus check for it.