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

Object Relations versions not saved correctly

    Details

      Description

      Steps to reproduce:

      1. Using a clean, fully patched installation of eZ Publish 5.2, create a new class with the following attributes:

      	1. Title [Text line], required, searchable
      	2. Related content [Object relations], not required, searchable
      

      2. Create an object (object_1) of that class, and use the "Object relations" attribute to relate to another object of the same class (object_2);
      3. Query "ezcontentobject_attribute" table for object_1 and inspect the XML for the object relations attribute:

      SELECT * FROM ezcontentobject_attribute WHERE contentobject_id = <object_1 id>
       
      ...
      <?xml version="1.0" encoding="utf-8"?>
      <related-objects>
      	<relation-list>
      		<relation-item priority="1" contentobject-id="127" contentobject-version="1" node-id="132" parent-node-id="111" contentclass-id="38" contentclass-identifier="12306" contentobject-remote-id="bbd20309bb9d3e6e7bb7289283f134b2"/>
      	</relation-list>
      </related-objects>
      ...
      

      The important bit is contentobject-version="1", which is OK.

      4. Edit object_2 and create a new version;
      5. Again, query the ezcontentobject_attribute table for object_1 and inspect the XML for the object relations attribute:

      <?xml version="1.0" encoding="utf-8"?>
      <related-objects>
      	<relation-list>
      		<relation-item priority="1" contentobject-id="127" contentobject-version="1" node-id="132" parent-node-id="111" contentclass-id="38" contentclass-identifier="12306" contentobject-remote-id="bbd20309bb9d3e6e7bb7289283f134b2"/>
      	</relation-list>
      </related-objects>
      

      contentobject-version is still 1, should be 2.

        Issue Links

          Activity

          Hide
          André Rømcke added a comment - - edited

          I don't think contentobject-version is supposed to reflect current version, that is accessible by fetching the object and asking for current version. This is a attribute intended to keep the version of when it was added, maybe it is updated on re publish of object_1, but that is it. If the intention was to have the live current version, then there would have been no need to have this attribute in the first place.

          Show
          André Rømcke added a comment - - edited I don't think contentobject-version is supposed to reflect current version, that is accessible by fetching the object and asking for current version. This is a attribute intended to keep the version of when it was added, maybe it is updated on re publish of object_1, but that is it. If the intention was to have the live current version, then there would have been no need to have this attribute in the first place.
          Hide
          André Rømcke added a comment - - edited

          @Doc:

          This page: http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Datatypes/Object-relations
          Needs to be updated on these points: contentobject_version, node_id, parent_node_id, contentclass_id, contentobject_remote_id to reflect these are values set during creation of relation, as they represent meta data, while the live data in the tables is as always accessible via fetch functions.

          Example for contentobject_version "The version number of the published version at the time when the relation was modified*."

          and after the table: "* As the intention of this data is to provide meta information about state when relation was created, you should instead of using this rather fetch the object using it's contentobject_id for front-end needs like listing locations, needing to know current version and so on."

          Show
          André Rømcke added a comment - - edited @Doc: This page: http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Datatypes/Object-relations Needs to be updated on these points: contentobject_version, node_id, parent_node_id, contentclass_id, contentobject_remote_id to reflect these are values set during creation of relation, as they represent meta data, while the live data in the tables is as always accessible via fetch functions. Example for contentobject_version "The version number of the published version at the time when the relation was modified*." and after the table: "* As the intention of this data is to provide meta information about state when relation was created, you should instead of using this rather fetch the object using it's contentobject_id for front-end needs like listing locations, needing to know current version and so on."
          Hide
          Ricardo Correia (Inactive) added a comment -

          QA Approved

          Show
          Ricardo Correia (Inactive) added a comment - QA Approved

            People

            • Assignee:
              Unassigned
              Reporter:
              Nuno Oliveira (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 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 - 15 minutes
                15m