Problem/Motivation
WseOverrideHooks::cron attempts to purge deleted workspaces & associated entities, but fails if any of those entities were moved to trash:
Error: Call to a member function getEntityType() on null in /var/www/html/docroot/modules/contrib/trash/src/TrashStorageTrait.php on line 27 #0 /var/www/html/docroot/core/modules/workspaces/src/Hook/WorkspacesHooks.php(138): Drupal__Core__Entity__Sql__SqlContentEntityStorageTrash69fc8ce2425a8->delete()
#1 /var/www/html/docroot/core/modules/workspaces/src/WorkspaceManager.php(204): Drupal\workspaces\Hook\WorkspacesHooks->{closure:Drupal\workspaces\Hook\WorkspacesHooks::cron():96}()
#2 /var/www/html/docroot/modules/contrib/trash/src/TrashWorkspaceManager.php(78): Drupal\workspaces\WorkspaceManager->executeOutsideWorkspace()
#3 /var/www/html/docroot/modules/contrib/wse/src/WseWorkspaceManager.php(83): Drupal\trash\TrashWorkspaceManager->executeOutsideWorkspace()
#4 /var/www/html/docroot/modules/contrib/wse/src/WseWorkspaceManager.php(104): Drupal\wse\WseWorkspaceManager->{closure:Drupal\wse\WseWorkspaceManager::executeOutsideWorkspace():83}()
#5 /var/www/html/docroot/modules/contrib/wse/src/WseWorkspaceManager.php(83): Drupal\wse\WseWorkspaceManager->doExecuteInTemporaryContext()
#7 /var/www/html/docroot/core/modules/workspaces/src/Hook/WorkspacesHooks.php(96): Drupal\me_content\StackWorkspaceManager->executeOutsideWorkspace()
#8 /var/www/html/docroot/modules/contrib/wse/src/Hook/WseOverrideHooks.php(40): Drupal\workspaces\Hook\WorkspacesHooks->cron()
#9 /var/www/html/docroot/core/lib/Drupal/Core/Cron.php(275): Drupal\wse\Hook\WseOverrideHooks->cron()
Note that this issue will have to also go hand-in-hand with a fix for https://www.drupal.org/project/drupal/issues/3553654, since calling the cron method directly from here will make this issue re-emerge.
Steps to reproduce
0. drush si standard -y --account-pass=admin
1. drush cr
2. drush en node workspaces workspaces_ui wse trash -y
3. Configure: enable trash for articles
4. Create a new workspace and switch to it
5. Create an article
6. Delete the article
7. Delete the workspace
8. drush cron -> see the error
Proposed resolution
Wrap the call in an inactive trash context if trash is enabled
Remaining tasks
User interface changes
n/a
API changes
n/a
Data model changes
n/a
Issue fork wse-3588995
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
Comment #2
alecsmrekar commentedComment #4
alecsmrekar commentedComment #5
alecsmrekar commentedComment #6
plachLooks good, thanks!
Comment #8
amateescu commentedMerged into 3.0.x, thanks as well :)