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

Content section not updated when moving content from one section to another.

    Details

      Description

      Creating content in the Media Library automatically sets the section to Media (3).

      When this content is then moved to the Content tree (Standard section) then the section field in the ezcontentobject table is not updated to reflect this change.

      If the content is only accessible by the frontend user (eg. Anonymous) when it is in the Standard section then after the above move scenario the user will be redirected to the login page as they do not have access.

      Update (eZ Support):

      Steps to reproduce:

      • Login to the admin interface;
      • Create a new content in Media library: Media / Images / test.jpg (image, content_id: 56)
      • Check 'ezcontentobject' table:

      SELECT * FROM ezcontentobject WHERE id = 56;
      +-----------------+-----------------+----+---------------------+---------------+------------+----------+----------+------------+----------------------------------+------------+--------+
      | contentclass_id | current_version | id | initial_language_id | language_mask | modified   | name     | owner_id | published  | remote_id                        | section_id | status |
      +-----------------+-----------------+----+---------------------+---------------+------------+----------+----------+------------+----------------------------------+------------+--------+
      |               5 |               1 | 56 |                   2 |             3 | 1497972905 | test.jpg |       14 | 1497972905 | 1669a276418c7557ce7a7f8ef9d0d37e |          3 |      1 |
      +-----------------+-----------------+----+---------------------+---------------+------------+----------+----------+------------+----------------------------------+------------+--------+
      1 row in set (0,00 sec)
      

      • On the admin interface, move the content from Media library to the Content tree: Home / Tests / test.jpg
      • Check 'ezcontentobject' table again:

      SELECT * FROM ezcontentobject WHERE id = 56;
      +-----------------+-----------------+----+---------------------+---------------+------------+----------+----------+------------+----------------------------------+------------+--------+
      | contentclass_id | current_version | id | initial_language_id | language_mask | modified   | name     | owner_id | published  | remote_id                        | section_id | status |
      +-----------------+-----------------+----+---------------------+---------------+------------+----------+----------+------------+----------------------------------+------------+--------+
      |               5 |               1 | 56 |                   2 |             3 | 1497972905 | test.jpg |       14 | 1497972905 | 1669a276418c7557ce7a7f8ef9d0d37e |          3 |      1 |
      +-----------------+-----------------+----+---------------------+---------------+------------+----------+----------+------------+----------------------------------+------------+--------+
      1 row in set (0,00 sec)
      

      • Notice that 'ezcontentobject.section_id' hasn't been updated to reflect the new section to which the content now belongs to - "standard", which has an id = 1;

        Issue Links

          Activity

          Hide
          Tomasz Madeyski (Inactive) added a comment -

          Described behaviour is correct. Section is just a property, every object has it, but there is no such thing as "section inheritance" meaning that logically you cannot "move content from one section to another", i.e. you can't move content out of a section. The section follows the content, until you decide to change it.

          Please check the docs to get more info about sections:
          https://doc.ez.no/eZ-Publish/Technical-manual/5.x/Concepts-and-basics/Content-management/Sections
          https://doc.ez.no/display/TECHDOC/Locations+and+Sections

          Show
          Tomasz Madeyski (Inactive) added a comment - Described behaviour is correct. Section is just a property, every object has it, but there is no such thing as " section inheritance" meaning that logically you cannot "move content from one section to another", i.e. you can't move content out of a section. The section follows the content, until you decide to change it. Please check the docs to get more info about sections: https://doc.ez.no/eZ-Publish/Technical-manual/5.x/Concepts-and-basics/Content-management/Sections https://doc.ez.no/display/TECHDOC/Locations+and+Sections
          Hide
          Peter Halasz added a comment -

          Dear Tomasz,

          Thank you for linking to outdate documentation.

          Could you please point me to where in eZ Platform's UI I can change that section?

          Looking at the eZ 5/Legacy docs it says that a content will always have it's main location's parent's location.

          If an object has multiple node assignments then it is always the section ID of the object referenced by the parent of the main node that will be used. In addition, if the main node of an object with multiple node assignments is changed then the section ID of that object will be updated.

          So in this case when you move content from one location to another you are changing the main location hence the section ID has to update.

          I don't think this ticket is Invalid.

          Regards,
          Peter

          Show
          Peter Halasz added a comment - Dear Tomasz, Thank you for linking to outdate documentation. Could you please point me to where in eZ Platform's UI I can change that section? Looking at the eZ 5/Legacy docs it says that a content will always have it's main location's parent's location. If an object has multiple node assignments then it is always the section ID of the object referenced by the parent of the main node that will be used. In addition, if the main node of an object with multiple node assignments is changed then the section ID of that object will be updated. So in this case when you move content from one location to another you are changing the main location hence the section ID has to update. I don't think this ticket is Invalid. Regards, Peter
          Hide
          Tomasz Madeyski (Inactive) added a comment -

          Dear Peter

          I linked to the legacy docs because section is afaik not documented in the new doc section yet. However section stems from legacy and due to our backwards compatibility with legacy, the relation between sections and content is the same way as it was in legacy.

          The documentation you cite is from a paragraph that describes which section is assigned when new content is created, and it applies only in the context of new content. Section is a property of the content, and follows the content. Location matters only when new content is created, when indeed the section of the parent locations content is used.

          How to change section in eZ Platform:
          Go to Administration dashboard -> Sections -> Assign to content. A content can only be in one section, so the newly assigned section replaces what was used before.

          Best regards,
          Tomasz Madeyski
          Product Support Engineer


          eZ Platform Enterprise Edition v1.9 is now available, Easier to Build a Solid Content Business
          http://ez.no/Products/eZ-Platform-Enterprise-Edition

          Show
          Tomasz Madeyski (Inactive) added a comment - Dear Peter I linked to the legacy docs because section is afaik not documented in the new doc section yet. However section stems from legacy and due to our backwards compatibility with legacy, the relation between sections and content is the same way as it was in legacy. The documentation you cite is from a paragraph that describes which section is assigned when new content is created, and it applies only in the context of new content. Section is a property of the content, and follows the content. Location matters only when new content is created, when indeed the section of the parent locations content is used. How to change section in eZ Platform: Go to Administration dashboard -> Sections -> Assign to content. A content can only be in one section, so the newly assigned section replaces what was used before. Best regards, Tomasz Madeyski Product Support Engineer eZ Platform Enterprise Edition v1.9 is now available, Easier to Build a Solid Content Business http://ez.no/Products/eZ-Platform-Enterprise-Edition
          Hide
          Peter Halasz added a comment -

          Dear Tomasz,

          As a follow out this is what the DB looks like on eZ Publish 5 when I move an item from Media Library to under Home:

          > select * from ezcontentobject where id = 160379;
          +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+
          | contentclass_id | current_version | id     | initial_language_id | language_mask | modified   | name  | owner_id | published  | remote_id                        | section_id | status |
          +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+
          |              53 |               1 | 160379 |                   2 |             2 | 1498205572 | test  |       14 | 1498205572 | fce21934e7e87d11e066358b792cbbdc |          3 |      1 |
          +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+
          1 row in set (0.00 sec)
           
          > select * from ezcontentobject where id = 160379;
          +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+
          | contentclass_id | current_version | id     | initial_language_id | language_mask | modified   | name  | owner_id | published  | remote_id                        | section_id | status |
          +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+
          |              53 |               1 | 160379 |                   2 |             2 | 1498205572 | test  |       14 | 1498205572 | fce21934e7e87d11e066358b792cbbdc |          1 |      1 |
          +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+
          

          As you can see the content's (which was a Documentation page type object) section id got updated correctly to reflect the Parent's section ID.

          Regards,
          Peter

          Show
          Peter Halasz added a comment - Dear Tomasz, As a follow out this is what the DB looks like on eZ Publish 5 when I move an item from Media Library to under Home: > select * from ezcontentobject where id = 160379; +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+ | contentclass_id | current_version | id | initial_language_id | language_mask | modified | name | owner_id | published | remote_id | section_id | status | +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+ | 53 | 1 | 160379 | 2 | 2 | 1498205572 | test | 14 | 1498205572 | fce21934e7e87d11e066358b792cbbdc | 3 | 1 | +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+ 1 row in set (0.00 sec)   > select * from ezcontentobject where id = 160379; +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+ | contentclass_id | current_version | id | initial_language_id | language_mask | modified | name | owner_id | published | remote_id | section_id | status | +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+ | 53 | 1 | 160379 | 2 | 2 | 1498205572 | test | 14 | 1498205572 | fce21934e7e87d11e066358b792cbbdc | 1 | 1 | +-----------------+-----------------+--------+---------------------+---------------+------------+-------+----------+------------+----------------------------------+------------+--------+ As you can see the content's (which was a Documentation page type object) section id got updated correctly to reflect the Parent's section ID. Regards, Peter
          Hide
          Tomasz Madeyski (Inactive) added a comment -

          Dear Peter

          Indeed, eZ Publish 5.x behaved differently (it updated section while moving content) so we need to make sure eZ Platform behaves the same way. Thank you for pointing that out. We also need to make sure to improve documentation regarding Sections.

          I'm reopening the ticket.

          Best regards,
          Tomasz Madeyski
          Product Support Engineer


          eZ Platform Enterprise Edition v1.9 is now available, Easier to Build a Solid Content Business
          http://ez.no/Products/eZ-Platform-Enterprise-Edition

          Show
          Tomasz Madeyski (Inactive) added a comment - Dear Peter Indeed, eZ Publish 5.x behaved differently (it updated section while moving content) so we need to make sure eZ Platform behaves the same way. Thank you for pointing that out. We also need to make sure to improve documentation regarding Sections. I'm reopening the ticket. Best regards, Tomasz Madeyski Product Support Engineer eZ Platform Enterprise Edition v1.9 is now available, Easier to Build a Solid Content Business http://ez.no/Products/eZ-Platform-Enterprise-Edition
          Show
          Jacek Foremski (Inactive) added a comment - PR: https://github.com/ezsystems/ezpublish-kernel/pull/2042
          Show
          André Rømcke added a comment - Merged: https://github.com/ezsystems/ezpublish-kernel/commit/f82dbe7bda7bac7698c1871bbacbe0fdfddc5aec

            People

            • Assignee:
              Unassigned
              Reporter:
              Peter Halasz
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: