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

View cache not cleared for new objects in object relations

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Medium Medium
    • Resolution: Invalid
    • Affects Version/s: 4.7 Maintenance
    • Fix Version/s: Customer request
    • Component/s: Caching
    • Labels:
      None
    • Environment:

      eZ Publish 4.7 fully patched.

      Description

      Steps to reproduce:

      1. Create a view full of the existing "product" class on main frontend siteaccess - "eng" in my tests:

      [full_product]
      Source=node/view/full.tpl
      MatchFile=full/product.tpl
      Subdir=templates
      Match[class_identifier]=product
      

      2. Create a new content class:

      Name: Recipe
      Identifier: recipe
      Container: No

      Add two attributes:

      Attribute Type: Text line

      • Name: Title
      • Identifier: title
      • Is required: checked

      Attribute Type: Object relations

      • Name: Product
      • Identifier: product
      • Selection method: browse
      • Allowed classes: product

      3. In product.tpl template, display all reverse related objects of "recipe" type:

      {def $objects=fetch( 'content', 'reverse_related_objects', hash( 'object_id', $node.object.id, 'attribute_identifier', '295' ) )}
       
      {foreach $objects as $object}
          {$object.name|wash} <br />
      {/foreach}
      

      Here, '295' is the id of the "product" attribute of the "recipe" class defined in step 2. Please change it to reflect the id of your "product" attribute.

      4. Configure viewcache.ini.append.php:

      [ViewCacheSettings]
      SmartCacheClear=enabled
       
      [recipe]
      DependentClassIdentifier[]=folder
      DependentClassIdentifier[]=landing_page
      ClearCacheMethod[]=object
      ClearCacheMethod[]=parent
      ClearCacheMethod[]=relating
      

      5. Create a new object in content tree of type "product". Called it "Product 1";
      6. Create a new object in content tree for the new "recipe" class in the content tree. Called it "Recipe 1" and on the "product" field selected "Product 1";
      7. Go, on the frontend siteaccess, to the "Product 1" page. "Recipe 1" should be listed there, but it's not;

      Workaround:

      8. Go back to admin interface, edit "Recipe 1" and publish (no content modifications required, just edit and publish);
      9. Go to frontend, and refresh (F5) "Product 1" page. "Recipe 1" is now listed.

        Activity

        Hide
        Nuno Oliveira (Inactive) added a comment -

        Note: this does not affect the removal of object relation associations, though. For example, if the "Recipe 1" object has an object relation to "Product 1" and you remove it, this will be reflected - as it should - in the frontend. Just refresh the "Product 1" page and "Recipe 1" will no longer be listed in the reverse related objects list.

        Show
        Nuno Oliveira (Inactive) added a comment - Note: this does not affect the removal of object relation associations, though. For example, if the "Recipe 1" object has an object relation to "Product 1" and you remove it, this will be reflected - as it should - in the frontend. Just refresh the "Product 1" page and "Recipe 1" will no longer be listed in the reverse related objects list.
        Hide
        Gunnstein Lye added a comment - - edited

        Confirmed on my end (4.7, fully patched).

        This is perfectly repeatable. After removing the related object as in the previous comment:

        • Edit Recipe 1, add relation to Product 1, publish, refresh Product 1 in frontend: No change.
        • Edit Recipe 1, change nothing, publish, refresh Product 1 in frontend: The relation shows.
        Show
        Gunnstein Lye added a comment - - edited Confirmed on my end (4.7, fully patched). This is perfectly repeatable. After removing the related object as in the previous comment: Edit Recipe 1, add relation to Product 1, publish, refresh Product 1 in frontend: No change. Edit Recipe 1, change nothing, publish, refresh Product 1 in frontend: The relation shows.
        Hide
        Gunnstein Lye added a comment -

        The issue is invalid, given the steps to reproduce. SmartCacheClear is enabled, and it uses ClearCacheMethod[]=relating. However, this "relating" method does not clear cache for attribute reverse relations. This is documented here:
        https://doc.ez.no/eZ-Publish/Technical-manual/4.x/Features/View-caching/Smart-view-cache-cleaning
        For ClearCacheMethod[]=relating it says: "Clear the view cache for related and reverse related objects that have relations of the "common" type and reverse related objects that have relations of the "XML embedded" type (according to the "ClearRelationTypes" configuration setting)."

        The "ClearRelationTypes" configuration setting is documented here:
        https://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Configuration-files/viewcache.ini/ViewCacheSettings/ClearRelationTypes/

        I conclude that ClearCacheMethod[]=relating does not affect attribute level relations, this is documented, so I'm closing the issue as invalid.

        Show
        Gunnstein Lye added a comment - The issue is invalid, given the steps to reproduce. SmartCacheClear is enabled, and it uses ClearCacheMethod[]=relating. However, this "relating" method does not clear cache for attribute reverse relations. This is documented here: https://doc.ez.no/eZ-Publish/Technical-manual/4.x/Features/View-caching/Smart-view-cache-cleaning For ClearCacheMethod[]=relating it says: "Clear the view cache for related and reverse related objects that have relations of the "common" type and reverse related objects that have relations of the "XML embedded" type (according to the "ClearRelationTypes" configuration setting)." The "ClearRelationTypes" configuration setting is documented here: https://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Configuration-files/viewcache.ini/ViewCacheSettings/ClearRelationTypes/ I conclude that ClearCacheMethod[]=relating does not affect attribute level relations, this is documented, so I'm closing the issue as invalid.

          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 - 3 hours, 15 minutes
              3h 15m