Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-5873

ContentType Update migration fails if a draft is already open

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 4.6.0, 4.4.4, 4.5.1, 3.3.34
    • 4.6.0, 3.3.33, 4.4.4, 4.5.1
    • None
    • None

    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.
       

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              pawel.niedzielski@ibexa.co Paweł Niedzielski
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: