Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-25416

Content Object Copy: db->commit called after content/publish

    XMLWordPrintable

Details

    Description

      Hello guys,

      We are implementing a kind of workflow based on LegacySearch events like in the eZ Recommendation Bundle:
      https://github.com/ezsystems/EzSystemsRecommendationBundle/blob/master/eZ/Publish/LegacySearch/RecommendationLegacySearchEngine.php#L41

      It works well but depending on the code that you do in the listener. (let's say a query to get the new added object in the new stack) there is a crash because the new copied object is not yet in the DB. (Content Id not found error)

      Indeed the the db->commit is done after the content/publish but the events are sent in the publish... which means that the object is not in the db at this time...
      https://github.com/ezsystems/ezpublish-legacy/blob/master/kernel/content/copy.php#L102

      I looked into the copySubtree and the commit is correctly called before the publish:
      https://github.com/ezsystems/ezpublish-legacy/blob/master/kernel/content/copysubtree.php#L233

      Thank you!

      Attachments

        Activity

          People

            plopix plopix
            plopix plopix
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: