Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The introduction of content_moderation_workspace_access() breaks Workspace in Drupal 8.8.
When upgrading to Drupal 8.8, the site gives the following error:
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to content_moderation_workspace_access() must be an instance of Drupal\workspaces\WorkspaceInterface, instance of Drupal\multiversion\Entity\Workspace given in content_moderation_workspace_access() (line 284 of core/modules/content_moderation/content_moderation.module).
Comment | File | Size | Author |
---|---|---|---|
#11 | multiversion-content-moderation-workspace-access-breaks-multiversion-D8.8-3100692-11.patch | 620 bytes | Matroskeen |
#5 | 3100692-multiversion_drupal8_8-5.patch | 807 bytes | agentrickard |
Comments
Comment #2
edward.radau CreditAttribution: edward.radau commentedI'm running into this as well. Do you use the multiversion module? I believe this is a bug with that module, not Workspace. multiversion module also implements a Workspace Entity which extends an WorkspaceInterface also provided by the multiversion module and there appears to be a conflict with the namespaces as far as I can tell.
Comment #3
agentrickardYes, it would be perfectly fine to move this issue to that module's queue.
Comment #4
agentrickardMoving to the proper queue.
Comment #5
agentrickardHere is a _very naive_ and untested patch that merely tries to replace the existing class definition of the Workspace entity with that from core.
I am pretty convinces that if this type of approach fails, the only answer will be an upgrade / migration path.
Comment #6
agentrickardComment #7
mattltHello,
Patch isn't working for me. It's throwing a different error now…
Thanks,
•• matt
Comment #8
agentrickardRight. It's simply not going to work. The two classes are far too different.
Comment #9
MatroskeenI have some general questions to project maintainers:
Comment #10
Matroskeen@jegg responded in Slack:
Thanks!
Comment #11
MatroskeenHi again,
My notes after some investigation:
Drupal\workspaces\WorkspaceInterface
required bycontent_moderation_workspace_access()
because this interface is provided by core Workspaces module (it'll require us to install Workspaces module);content_moderation_workspace_access()
provides access checking when we publish the whole workspace and especially looking at "publish" action. We don't have this operation in Multiversion/Deploy implementation, so I think we can just apply a workaround and do not call this implementation;Comment #12
agentrickardThis seems like it would work.
I was going to propose a core patch that removes the type hint on content_moderation_workspace_access() as a temporary measure until we fix the upgrade path, but I think this is faster.
I can test this today.
Comment #13
agentrickardThis patch appears to be working in a test of default core (not on a real site).
Not sure what the test fails are about.
Comment #14
MatroskeenTests fail because of #3090566: Make Multiversion compatible with the latest changes related to url aliases in Drupal 8.8.x.
Comment #15
agentrickardAh, so that patch has to go in first.
Comment #16
mohangathala CreditAttribution: mohangathala at TATA Consultancy Services for Pfizer, Inc. commentedsolution provided here : https://www.drupal.org/project/drupal/issues/3145352 and it works for me.