Currently working on a project with a few custom entities that needs to be deployable in addition to nodes ; those entities have a custom storage backend, and use ContentEntityStorageTrait; to get the various Multiversion helpers.

It almost work, except that buildQuery returns early and doesn't correctly handle deleted entties.

Right now, there's

    // Prevent to modify the query before entity type updates.
    if (strpos($this->entityType->getStorageClass(), 'Drupal\multiversion\Entity\Storage') === FALSE) {
      return $query;
    }

In ContentEntityStorageTrait, which prevents using the trait with any storage class that's not explicitely in the Multiversion namespace. It'd be very nice to improve that.

I think the easiest fix to get in would be to simply change that to check that the storage implements Multiversion ContentEntityStorageInterface.

CommentFileSizeAuthor
#2 2890441-2-check-interface-not-namespace.patch695 bytesDeFr

Comments

DeFr created an issue. See original summary.

DeFr’s picture

Status: Active » Needs review
StatusFileSize
new695 bytes

  • jeqq committed 7751662 on 8.x-1.x authored by DeFr
    Issue #2890441 by DeFr: ContentEntityStorageTrait can't be used outside...
jeqq’s picture

Status: Needs review » Fixed

Thanks @DeFr!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.