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

Relationlist contains wrong content after content removal

    Details

      Description

      Steps to reproduce

      Prepare the environment:

      1. Prepare eZ Publish 4.7 installation, fully patched;
      2. Duplicate "article" class, and add a new "object relations" attribute to the new class. Class is called "article 2", attribute is called "related articles";
      3. Create the following content structure:

      Home
      	Tests (folder)
      	Tests 2 (folder)
      

      Reproduce the issue:

      1. Create 2 new "article" objects under /Tests:

      Article 1 (node_id: 125, object_id: 120)
      Article 2 (node_id: 126, object_id: 121)

      2. Create new "article 2" object also under /Tests, and add both "Article 1" and "Article 2" to object relations field:

      13151 Test article (node_id: 127, object_id: 122)

      3. Check content of 'ezcontentobject_attribute' table:

      SELECT * FROM ezcontentobject_attribute WHERE contentobject_id = 122 AND contentclassattribute_id = 307;
      +-----------------------+--------------------------+------------------+------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+-----+---------------+-------------+--------------+-----------------+---------+
      | attribute_original_id | contentclassattribute_id | contentobject_id | data_float | data_int | data_text                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | data_type_string     | id  | language_code | language_id | sort_key_int | sort_key_string | version |
      +-----------------------+--------------------------+------------------+------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+-----+---------------+-------------+--------------+-----------------+---------+
      |                     0 |                      307 |              122 |          0 |     NULL | <?xml version="1.0" encoding="utf-8"?><related-objects><relation-list><relation-item priority="1" contentobject-id="120" contentobject-version="1" node-id="125" parent-node-id="103" contentclass-id="16" contentclass-identifier="article" contentobject-remote-id="fe79d4dcc39a5111fc604ba9e169e6f3"/><relation-item priority="2" contentobject-id="121" contentobject-version="1" node-id="126" parent-node-id="103" contentclass-id="16" contentclass-identifier="article" contentobject-remote-id="f3fa332a108f22a9ada2e0bbd3c27977"/></relation-list></related-objects>   | ezobjectrelationlist | 755 | eng-GB        |           2 |            0 |                 |       1 |
      +-----------------------+--------------------------+------------------+------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+-----+---------------+-------------+--------------+-----------------+---------+
      1 row in set (0.00 sec)
      

      Note: "contentclassattribute_id = 307" refers to the Id of the "Related articles" attribute for the new class "article 2".

      4. Add a new location - "Tests 2" folder - to "Article 1" and "Article 2", and make that the main location. Content structure is now:

      Home
      	Tests
      		Article 1 (node_id: 125, object_id: 120)
      		Article 2 (node_id: 126, object_id: 121)
      		13151 Test article (node_id: 127, object_id: 122)
      	Tests 2
      		Article 1 (node_id: 128, object_id: 120, main location)
      		Article 2 (node_id: 129, object_id: 121, main location)
      

      5. Check content of 'ezcontentobject_attribute' table. Results are the same as the ones in step 3;
      6. Remove the firt location - "Tests" folder - from "Article 1";
      7. Check content of 'ezcontentobject_attribute' table. Results are the same as the ones in step 3. That's not correct, as XML structure in "data_text" now contains a dead node - /Tests/Article 1.

      Additional test:

      8. Remove "Article 2" from both locations;
      9. Check content of 'ezcontentobject_attribute' table:

      SELECT * FROM ezcontentobject_attribute WHERE contentobject_id = 122 AND contentclassattribute_id = 307;
      +-----------------------+--------------------------+------------------+------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+-----+---------------+-------------+--------------+-----------------+---------+
      | attribute_original_id | contentclassattribute_id | contentobject_id | data_float | data_int | data_text                                                                                                                                                                                                                                                                                                                                     | data_type_string     | id  | language_code | language_id | sort_key_int | sort_key_string | version |
      +-----------------------+--------------------------+------------------+------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+-----+---------------+-------------+--------------+-----------------+---------+
      |                     0 |                      307 |              122 |          0 |     NULL | <?xml version="1.0" encoding="utf-8"?><related-objects><relation-list><relation-item priority="1" contentobject-id="120" contentobject-version="1" node-id="125" parent-node-id="103" contentclass-id="16" contentclass-identifier="article" contentobject-remote-id="fe79d4dcc39a5111fc604ba9e169e6f3"/></relation-list></related-objects>   | ezobjectrelationlist | 755 | eng-GB        |           2 |            0 |                 |       1 |
      +-----------------------+--------------------------+------------------+------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+-----+---------------+-------------+--------------+-----------------+---------+
      1 row in set (0.00 sec)
      

      The removed node is completely removed from the relation list as it should, but there was no update for the "/Tests/Article 1" dead node. As a sidenote, this can not be solved by republishing the "13151 Test article" object.

        Activity

        Gunnstein Lye logged work - 18/Feb/15 3:30 PM
        • Time Spent:
          2 hours
           

          .

        Gunnstein Lye logged work - 19/Feb/15 9:55 AM
        • Time Spent:
          1 hour, 5 minutes
           

          .

        Gunnstein Lye logged work - 19/Feb/15 12:00 PM
        • Time Spent:
          1 hour
           

          .

        Gunnstein Lye logged work - 19/Feb/15 12:45 PM
        • Time Spent:
          4 hours, 20 minutes
           
          <No comment>
        Gunnstein Lye logged work - 19/Feb/15 6:15 PM
        • Time Spent:
          20 minutes
           

          .

        Gunnstein Lye logged work - 20/Feb/15 9:10 AM - edited
        • Time Spent:
          1 hour, 20 minutes
           

          Closing as invalid. The documentation makes it clear that this XML can not be relied upon to always be updated. Most values are only set when the object relation is modified.
          https://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Datatypes/Object-relations
          "Raw output
          The .content of an ezcontentobjectattribute object using this datatype returns a hash containing one element called relation_list."
          (...)
          "node_id (string): The ID number of the node at the time when the relation was modified."

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 1 day, 2 hours, 5 minutes
              1d 2h 5m