Add revision support

Created on 24 July 2023, over 1 year ago

Problem/Motivation

Creating this issue for version 2.X based off 8.x-1.x-dev. https://www.drupal.org/project/eck/issues/2788507 ✨ Add revision support Needs review . Copying the text from this issue to here.

For a lot of use cases you use ECK in a way which is similar to paragraphs module. Once you have also any kind of workflow on those sites, you need revision support for the referenced entities, using entity_reference_revisions.

Given that it would be quite helpful to have revision support as part of ECK

Proposed resolution
Make it possible to switch of revision support when creating an entity type
Default to TRUE
Backport the changes in #2721313: Upgrade path between revisionable / non-revisionable entities in some temporary subclasses inside ECK
Provide an update path for all entity types
Write tests for it

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States chambers

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @chambers
  • πŸ‡ΊπŸ‡ΈUnited States chambers
  • πŸ‡ΊπŸ‡ΈUnited States chambers
  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States chambers
  • It works for new ECK types created after patching.

    -----------------------
    Test for types created before the patching.

    Drupal\Core\Entity\Query\QueryException: No revision table for eck_2_type, invalid query. in Drupal\Core\Entity\Query\Sql\Query->prepare() (line 99 of /var/www/html/local6site/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php).
    

    Testing with workflow

    If your existing eck type has content moderation workflow;

    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydatabase.dr_' doesn't exist: SELECT "base"."id" AS "id", "base"."type" AS "type", "base"."uuid" AS "uuid", "base"."langcode" AS "langcode" FROM "dr_eck_1_type" "base" INNER JOIN "dr_" "revision" ON "revision"."id" = "base"."id" AND "revision"."" IN (:revisionIds__0); Array ( [:revisionIds__0] => ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultipleRevisionsFieldItems() (line 624 of /var/www/html/local6site/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
    

    Tested with drupal 10.1.2 & PHP 8.1

  • Status changed to Closed: duplicate about 1 year ago
  • πŸ‡¨πŸ‡¦Canada RobLoach Earth

    There's been a lot of work on this over at https://www.drupal.org/project/eck/issues/2788507 ✨ Add revision support Needs review . Mind if we combine them?

  • πŸ‡ΊπŸ‡ΈUnited States chambers

    This one shouldn't have been closed as duplicate for 2 reasons.
    1. The other issue is for version 8.x-1.x-dev. This one is for version 2.0.0
    2. The other issue patches didn't work for this version because of Drupal 10 changes and this is for version 2.0.0.

    So this is unrelated to the other issue.

    Sorry, I never got an email there were responses.

  • Status changed to Needs review about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States chambers
  • πŸ‡¨πŸ‡¦Canada RobLoach Earth

    Oops! Good catch, thanks.

  • First commit to issue fork.
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    Created a MR based on the patch, will review there.

  • Merge request !43Add revision support β†’ (Open) created by dieterholvoet
  • Status changed to Needs work 11 months ago
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I left some comments in the MR. Additionally, a generic revision UI was added in Drupal 10.1 ( ✨ Implement a generic revision UI Fixed ), so we should probably rewrite some stuff to make use of that.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    The changes from #2788507-116 ✨ Add revision support Needs review should still be added here as well.

  • πŸ‡ΊπŸ‡ΈUnited States hungdo

    Attaching a patch file that works for eck 2.0.0 on my local.

  • Status changed to Needs review about 1 month ago
  • Hello,

    I have created a patch based on changes available on #2788507-116 ✨ Add revision support Needs review for the 2.0.0.

    Also the changes from #2788507-116 ✨ Add revision support Needs review do not work for existing eck entities. so I have modified the update_hook which will make the existing entities revisionable.

    Note - This patch will make all the existing eck entities revisionable.

Production build 0.71.5 2024