Details
Description
Originally reported by Ramzi Arfaoui.
Hi pawel , I hope you’re going well
I added below action to contentype:actions: - { action: remove_drafts, value: null }but It fails because the ContentTypeUpdateStepExecutor is trying to load a draft in tryToCreateContentTypeDraft() .
So we got: The Content Type is owned by someone else...
From what I can see we try to delete a draft before going in to the action and it doesn’t make sense to have post action because is is handeled by the method above!
IMHO, this action should run when it is defined before updating the contenttype, but this is not the Action design.
To solve the Issue, we should load the contenttype draft by ignoring its ownership to be able to remove the draft:
private function tryToCreateContentTypeDraft(ContentType $contentType): ContentTypeDraft{ try { $this->contentTypeService->loadContentTypeDraft($contentType->id); } catch (NotFoundException $e) { $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentType->id, true); $this->contentTypeService->deleteContentType($contentTypeDraft); } finally {and it works fine.
what do you think?
After investigating further, it became apparent that the issue is that when executing migrations for ContentType, we attempt to load and delete a draft for the user executing the migration. However, since more users can exist in Ibexa DXP instance and start modifying the ContentType - possibly leaving a draft in the system - this type of migration will fail.