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

Kernel issue: By doing a subtree copy with subitems using ObjectRelation, the Relation is broken on the copy until you republish it.

    Details

      Description

      Steps to reproduce:

      1. Prepare a new test installation, fully updated;
      2. In admin interface, create a new class:

      Name: 5272
      Identifier: 5272
       
      Attributes:
       
      Attribute Type: Text line
      • Name: Title
      • Identifier: title
      • Is required: checked
       
      Attribute Type: Content relation (single)
      • Name: Related
      • Identifier: related
      

      3. Define test content structure:

      Home
      	Folder 1 (content_id: 52, location_id: 54)
      		5272 Item 1 (content_id: 53, location_id: 55)
      	Folder 2 (content_id: 54, location_id: 56)
      		Article 1 (content_id: 55, location_id: 57)
      

      4. Relate "Folder 1/5252 Item 1" with "Folder 2/Article 1";
      5. Check the 'ezcontentobject_link' table:

      mysql> SELECT * FROM ezcontentobject_link;
      +--------------------------+-----------------------+----------------------------+----+---------------+---------------------+
      | contentclassattribute_id | from_contentobject_id | from_contentobject_version | id | relation_type | to_contentobject_id |
      +--------------------------+-----------------------+----------------------------+----+---------------+---------------------+
      |                      184 |                    53 |                          2 |  1 |             8 |                  55 |
      +--------------------------+-----------------------+----------------------------+----+---------------+---------------------+
      1 row in set (0.00 sec)
      

      6. Using the Public API, perform a "Home/Folder 1" subtree copy;

      Ref: https://github.com/ezsystems/CookbookBundle/blob/master/Command/SubtreeCommand.php

      The content structure now is:

      Home
      	Folder 1 (content_id: 52, location_id: 54)
      		5272 Item 1 (content_id: 53, location_id: 55)
      	Folder 2 (content_id: 54, location_id: 56)
      		Article 1 (content_id: 55, location_id: 57)
      	Folder 1 (content_id: 56, location_id: 58)
      		5272 Item 1 (content_id: 57, location_id: 59)
      

      7. Check the 'ezcontentobject_link' table again - there should be a new record for the new relation (5272 Item 1 (content_id: 57, location_id: 59) -> Article 1 (content_id: 55, location_id: 57)), but there is not.

      Additional test:

      1. Using the Public API, edit and publish the newly copied "Folder 1/5272 Item 1" content, without modifying anything;

      Ref: https://github.com/ezsystems/CookbookBundle/blob/master/Command/UpdateContentCommand.php

      2. Check the 'ezcontentobject_link' table, which is now correct:

      mysql> SELECT * FROM ezcontentobject_link;
      +--------------------------+-----------------------+----------------------------+----+---------------+---------------------+
      | contentclassattribute_id | from_contentobject_id | from_contentobject_version | id | relation_type | to_contentobject_id |
      +--------------------------+-----------------------+----------------------------+----+---------------+---------------------+
      |                      184 |                    53 |                          2 |  1 |             8 |                  55 |
      |                      184 |                    57 |                          3 |  2 |             8 |                  55 |
      +--------------------------+-----------------------+----------------------------+----+---------------+---------------------+
      2 rows in set (0.00 sec)
      

        Issue Links

          Activity

          Hide
          Roland Benedetti added a comment -

          Sébastien Morel
          Hello,

          Yes you should wait for something more, coming probably in the coming week.
          3rd line is on it.

          Roland

          Show
          Roland Benedetti added a comment - Sébastien Morel Hello, Yes you should wait for something more, coming probably in the coming week. 3rd line is on it. Roland
          Hide
          Bertrand Dunogier added a comment -

          Hi Sebastien.

          We have tried one way, but it wasn't really conclusive. The idea was to apply what we do to copy() in https://github.com/ezsystems/ezpublish-kernel/pull/1558 to subtreeCopy(). Turns out it doesn't really work with the batch aspect of this operation.

          We are going to try another way, we'll let you know.

          Show
          Bertrand Dunogier added a comment - Hi Sebastien. We have tried one way, but it wasn't really conclusive. The idea was to apply what we do to copy() in https://github.com/ezsystems/ezpublish-kernel/pull/1558 to subtreeCopy() . Turns out it doesn't really work with the batch aspect of this operation. We are going to try another way, we'll let you know.
          Hide
          Sébastien Morel added a comment -

          Hey guys,

          As I mentioned in the PR, the new fix works for me.

          Thank you!

          Show
          Sébastien Morel added a comment - Hey guys, As I mentioned in the PR, the new fix works for me. Thank you!
          Show
          André Rømcke added a comment - Merged: https://github.com/ezsystems/ezpublish-kernel/commit/e82d33475ea5e1ba1b527c1c72aab0ba75968555
          Hide
          Paulo Nunes (Inactive) added a comment -

          Tested and approved by QA for 5.4, ezpublish-kernel 6.0 (Customers version) and master.

          Show
          Paulo Nunes (Inactive) added a comment - Tested and approved by QA for 5.4, ezpublish-kernel 6.0 (Customers version) and master.

            People

            • Assignee:
              Unassigned
              Reporter:
              Nuno Oliveira (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: