entity_workflow_workspace doesn't work well with existing workspaces

Created on 8 January 2025, 3 months ago

Problem/Motivation

By default, when one installs the workspaces module it creates a "Stage" workspace. Or an existing site using the workspaces module might have a lot of workspaces worked on in parallel.

If the entity_workflow_workspace is installed the existing workspaces get a NULL workflow state. This disallows for usage of the workflows in them.

Steps to reproduce

  • Install core and entity_workflow_workspace module.
  • Open the "Stage" workspace manage - /admin/config/workflow/workspaces/manage/stage
  • Click on the "Workspace workflow" tab.

Expected result: You should at least see a blank form with a message to the user.

Actual result: And exception is thrown -

InvalidArgumentException: The state '' does not exist in workflow. in Drupal\entity_workflow_workspace\Plugin\WorkflowType\EntityWorkflowWorkspace->getState() (line 169 of modules/contrib/entity_workflow/modules/entity_workflow_workspace/src/Plugin/WorkflowType/EntityWorkflowWorkspace.php).

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇮🇳India ajits India

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

Merge Requests

Comments & Activities

  • Issue created by @ajits
  • 🇮🇳India ajits India

    Created a drush command. The hooks hook_install and hook_modules_installed did not work. They seem to be executed very early.

  • Status changed to Needs work 18 days ago
  • 🇷🇴Romania amateescu

    I've committed this fix to entity_workflow, so we can now use hook_install() to insert this data.

    I would set the draft state for open workspaces directly in the hook_install() implementation, and create a queue for populating the state of closed workspaces.

  • 🇮🇳India ajits India

    @amateescu - I tried to move the logic to hook_install as you suggested; however, I still get the error that pushed to me to write the command in the first place:

    Field entity_workflow_workspace is unknown.

  • 🇮🇳India ajits India

    I have pushed the code to hook_deploy_NAME instead. Please let me know if I should remove the Drush command.

Production build 0.71.5 2024