Problem/Motivation
Trying to delete a workspace that has associated content results in the following error:
The website encountered an unexpected error. Please try again later.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "0" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 150 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).
Drupal\Core\Entity\EntityTypeManager->getHandler(0, 'storage') (Line: 208)
Drupal\Core\Entity\EntityTypeManager->getStorage(0) (Line: 161)
Drupal\workspaces\WorkspaceAssociation->getAssociatedRevisions('workspace_id', 0, 'node') (Line: 96)
Drupal\workspaces\Form\WorkspaceDeleteForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 532)
Drupal\Core\Form\FormBuilder->retrieveForm('workspace_delete_form', Object) (Line: 278)
...
Steps to reproduce
- Create a workspace and activate it
- Create content in the workspace
- Switch to the Default workspace
- Click the Delete link in the dropbutton for the workspace created in 1, e.g. /admin/config/workflow/workspaces/manage/[your_workspace_id]/delete
Proposed resolution
Remove incorrect array_keys() call (see patch)
Remaining tasks
- Verify patch/tests
Comment | File | Size | Author |
---|---|---|---|
#15 | 3181508-workspace-delete-bug-15.patch | 4.04 KB | tedfordgif |
#15 | 3181508-workspace-delete-bug-15.test-only.patch | 3.07 KB | tedfordgif |
#15 | 3181508_interdiff_13_15.txt | 746 bytes | tedfordgif |
Issue fork drupal-3181508
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
tedfordgif CreditAttribution: tedfordgif at WebFirst, Inc. commentedComment #3
tedfordgif CreditAttribution: tedfordgif at WebFirst, Inc. commentedComment #4
tedfordgif CreditAttribution: tedfordgif at WebFirst, Inc. commentedAnd now with a test that works. Probably should do this with a unit test...
Comment #5
tedfordgif CreditAttribution: tedfordgif at WebFirst, Inc. commentedComment #6
tedfordgif CreditAttribution: tedfordgif at WebFirst, Inc. commentedComment #7
larowlanthese comments look to be copy/paste
Other than that, this looks good to me
Comment #8
tedfordgif CreditAttribution: tedfordgif at WebFirst, Inc. commentedThanks for the review--apologies for being lazy with the comments on the first pass.
Comment #9
tedfordgif CreditAttribution: tedfordgif at WebFirst, Inc. commentedBumping status
Comment #11
tedfordgif CreditAttribution: tedfordgif at WebFirst, Inc. commentedPatches were tested in wrong order, my bad. The patch with the fix passes.
Comment #12
amateescu CreditAttribution: amateescu for Tag1 Consulting commentedNice find! I looked around and we only test deleting workspaces in a kernel test, that's why we missed this in #3062434: Track the workspace of a revision in a base field and convert the workspace_association entity type to a custom index.
It's not really relevant which user deletes the workspace, so we could change this to "Verifies that a workspace with existing content can be deleted."
Let's move this test method to the existing functional test for workspace's UI:
\Drupal\Tests\workspaces\Functional\WorkspaceTest
and rename it to
testDeleteWorkspaceWithExistingContent
Let's use
switchToWorkspace()
instead.We can use single quotes here :)
Comment #13
tedfordgif CreditAttribution: tedfordgif at WebFirst, Inc. commentedFeedback from #12 addressed. I also added an assertion to give a more informative error message if the workspace switcher block isn't enabled (meaning the test was written incorrectly).
It felt a bit arbitrary to expand the WorkspaceTest class, given that all the required modules aren't used in each test, but that is small beans.
Comment #14
amateescu CreditAttribution: amateescu for Tag1 Consulting commentedThanks, looks great now!
Comment #15
tedfordgif CreditAttribution: tedfordgif at WebFirst, Inc. commentedSo much fun for a one line patch--forgot to capitalize FALSE/TRUE.
Comment #18
amateescu CreditAttribution: amateescu for Tag1 Consulting commentedPlease ignore #17, the patch from #15 is the one that is RTBC.
Comment #21
catchCommitted/pushed to 9.2.x and cherry-picked to 9.1.x, thanks!