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

When calling the method eZContentObject::relatedObjectCount with the IgnoreVisibility parameter, the count is not good

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 5.3
    • 4.7.0, 5.0
    • None
    • OS : debian 7.4
      php 5.3.28-1~dotdeb
      mysql 5.5.35
      apache 2.2.22
      eZ Publish 4.7.0

    Description

      The issue is not visible in the case of reverse relation.
      In the case of direct relatio, if the IgnoreVisibility param is given to FALSE, the result is not good.
      In the method eZContentObject::relatedObjectCount(), the definition of $showInvisibleNodesCond is the following :

      $showInvisibleNodesCond = self::createFilterByVisibilitySQLString( $params['IgnoreVisibility'], 'inner_object' );
      

      And it can be advantageously changed to the following :

      $showInvisibleNodesCond = self::createFilterByVisibilitySQLString( $params['IgnoreVisibility'],
      $reverseRelatedObjects ? 'inner_object' : 'outer_object' );
      

      Since inner_objet represents the source while outer_objet represents the target of the relationship, in the case of direct relationship, we want to check the visibility of the target, but not of the source !
      On the other side, in the case of reverse relationships, outer_object and inner_object both represent the source object of the SQL query, and they could be interchanged on the condition $showInvisibleNodesCond without changing the result. (the SQL query is not symmetric)

      Attachments

        Activity

          People

            Unassigned Unassigned
            arnaudchasseux arnaudchasseux
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: