Problem/Motivation

I have a custom entity type which is instance of RevisionableContentEntityBase. Because I don't need "published" property and related functionality but I need content moderation and scheduler for custom entity type at the same type.

Example,

final class MyCustomEntity extends RevisionableContentEntityBase implements MyCustomEntityInterface {}

As result I get AssertionError: assert($entity instanceof EditorialContentEntityBase) in assert() (line 559 of modules/contrib/scheduler_content_moderation_integration/scheduler_content_moderation_integration.module).

Proposed resolution

In my opinion hook shouldn't break entity save process if some condition isn't met.
My proposal is to replace assert($entity instanceof EditorialContentEntityBase); with if (!$entity instanceof EditorialContentEntityBase) {

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

deimos created an issue. See original summary.

deimos’s picture

Assigned: Unassigned » deimos

I will provide a proposed solution.

deimos’s picture

Assigned: deimos » Unassigned
Status: Needs work » Needs review

Committed fix as described in the proposed solution.
Please review.

deimos’s picture

Attach a patch file with the same fix to use on my site and don't be dependent from MR and for others to get quick fix if they face the same issue.

  • smustgrave committed 5ab9bec4 on 3.0.x
    feat: #3512832 Unable to create/edit entity of custom entity type if it...
smustgrave’s picture

Version: 3.0.4 » 3.0.x-dev
Status: Needs review » Fixed

I'm fine with this change, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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