From 7f51e57c77a88e10fb283a34099480b7ca617ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Wed, 11 Oct 2023 20:18:12 +0200 Subject: [PATCH] IBX-6738: Fixed content type group deletion when it contains orphaned content type drafts --- src/lib/Repository/ContentTypeService.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/Repository/ContentTypeService.php b/src/lib/Repository/ContentTypeService.php index e1773a3b7f..8590542653 100644 --- a/src/lib/Repository/ContentTypeService.php +++ b/src/lib/Repository/ContentTypeService.php @@ -297,6 +297,11 @@ public function deleteContentTypeGroup(APIContentTypeGroup $contentTypeGroup): v $this->repository->beginTransaction(); try { + $ContentTypesDrafts = $this->contentTypeHandler->loadContentTypes($contentTypeGroup->id, SPIContentType::STATUS_DRAFT); + foreach ($ContentTypesDrafts as $contentTypeDraft) { + $this->contentTypeHandler->delete($contentTypeDraft->id, SPIContentType::STATUS_DRAFT); + } + $this->contentTypeHandler->deleteGroup( $loadedContentTypeGroup->id );