Handle exception on entity delete

Created on 8 February 2024, 7 months ago

Problem/Motivation

When attempting to delete a menu associated with a group, an error is encountered. This issue has been reported on the Group Content Menu module's issue tracker as well https://www.drupal.org/project/group_content_menu/issues/3345151 🐛 Error when removing a menu Needs work Seems It's worth considering raising an issue on the Redirect module as this could potentially be resolved within its scope.

Drupal\Core\Entity\EntityStorageException: Some mandatory parameters are missing ("group") to generate a URL for route "entity.group_content_menu.canonical". in Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete() (line 763 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\Core\Routing\UrlGenerator->getInternalPathFromRoute() (Line: 138)
Drupal\Core\Routing\UrlGenerator->getPathFromRoute() (Line: 71)
Drupal\Core\Render\MetadataBubblingUrlGenerator->getPathFromRoute() (Line: 808)
Drupal\Core\Url->getInternalPath() (Line: 87)
redirect_entity_delete()
call_user_func_array() (Line: 409)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 416)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 217)
Drupal\Core\Entity\EntityStorageBase->invokeHook() (Line: 900)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook() (Line: 462)
Drupal\Core\Entity\EntityStorageBase->delete() (Line: 753)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete() (Line: 360)
Drupal\Core\Entity\EntityBase->delete() (Line: 71)
Drupal\Core\Entity\ContentEntityDeleteForm->submitForm()
call_user_func_array() (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 597)
Drupal\Core\Form\FormBuilder->processForm() (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult() (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

1. Install group content menu .
2. Install group as well.
3. create a group /admin/group
4. Then, Create menus type under the group content menu /admin/group/types.
5 . Enable the menu type on the group content enablement tab i.e. /admin/group/types/manage/{group_type}/content.
6. Try to add group menu. Navigate to /admin/group and click on added group then click on group menu tab or path is group/{group_id}/menus.

🐛 Bug report
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇮🇳India sumit-k

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024