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

Add new function to get the ID of an object state by its full identifier

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Obsolete
    • Icon: Medium Medium
    • Customer request
    • 4.2.0
    • Misc
    • None

    Description

      It would be really helpful to get a new function (e.g. eZContentObjectState::fetchByFullIdentifier() or modify eZContentObjectState::fetchByIdentifier()) that returns the ID of an object state by it full id (e.g. 'ez_lock/locked' ). A possible implementation could be:

      public static function fetchStateIDByIdentifier( $stateIdentifier )
      {
      list( $groupString, $stateString ) = explode( '/', $stateIdentifier );
      $db = eZDB::instance();
      $query = 'SELECT ezcobj_state.id FROM ezcobj_state, ezcobj_state_group
      WHERE ezcobj_state.identifier=\ . $db->escapeString( trim( $stateString ) ). '\' AND
      ezcobj_state_group.identifier=\ . $db->escapeString( trim( $groupString ) ) . '\' AND
      ezcobj_state.group_id=ezcobj_state_group.id';
      $result = $db->arrayQuery( $query );
      if ( is_array( $result ) && count( $result) == 1 && array_key_exists( '0', $result ) && array_key_exists( 'id', $result['0'] ) )
      {
      return array( 'result' => $result['0']['id'] );
      }
      return array( 'result' => -1 );
      }

      Attachments

        Activity

          People

            unknown unknown
            jkn jkn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: