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

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

    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!

        Activity

        Show
        Sébastien Morel added a comment - PR: https://github.com/ezsystems/ezpublish-legacy/pull/1235 ++
        Hide
        Bertrand Dunogier added a comment -

        Review isn't finished yet. There is an unsolved debate about wether or not commiting in the middle of the operation is a bad thing or not;

        Show
        Bertrand Dunogier added a comment - Review isn't finished yet. There is an unsolved debate about wether or not commiting in the middle of the operation is a bad thing or not;

          People

          • Assignee:
            Sébastien Morel
            Reporter:
            Sébastien Morel
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: