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

eZContentObject::contentClassIdentifier doesn't use classidentifier cache

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Obsolete
    • Icon: High High
    • 4.1.0alpha1
    • 3.10.0, 3.9.4, 4.0.0
    • Caching
    • None

    Description

      eZContentObject::contentClassIdentifier() returns the content object's class identifier based on its numerical ID.

      The class identifier is stored as a local property, but there are two issues:

      • if the same transformation is requested for another object of the same class, it is fetched from the database again
      • the classidentifiers_<dbname>.php cache is not used, while it has all the required data

      eZContentObjectTreeNode::classIDByIdentifier() does the exact opposite and uses / handles the classidentifier cache. An easy cache, with no side effect as far as I can tell, would be to expand this method this way:

      static function classIDByIdentifier( $identifier, $reverse = false )
      

      At the end of the method, when looking for the value, this piece of code should be added before the if ( isset( $identifierHash... call:

              if ( $reverse )
              {
                  $identifierHash = array_flip( $identifierHash );
              }
      

      Then in eZContentObject::contentClassIdentifier, the DB query should be changed to a call to this method:

      $classIdentifier = eZContentObjectTreeNode::classIDByIdentifier( $this->ClassID, true )
      

      Attachments

        Activity

          People

            andre1 andre1
            bd bd
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: