/*!
\static
Fetches the information collection by object attribute ID.
492187
static function fetchByObjectAttributeID( $id, $contentobjectAttributeID, $asObject = true )
    {
        return eZPersistentObject::fetchObject( eZInformationCollectionAttribute::definition(),
                                                null,
                                                array( 'informationcollection_id' => $id,
                                                       'contentobject_attribute_id' => $contentobjectAttributeID ),
                                                $asObject );
    }
653680
public function getAttribute($key)
    {
        // If the attribute is not already available to the
        // model, let's look for any configured relationships
        // that match the $key and return a Collection|static
        if(!$attribute = parent::getAttribute($key)){

            if($relationship = $this->resolveRelationship($key)){

                $attribute = $relationship->getResults();

                $this->relations[$key] = $relationship;
            }
        }

        return $attribute;
    }
176296
private function _getObject($id, $revision = null)
    {
        if ($revision === null) {
            $select = Statement::get(
                'GET_CURRENT_OBJECT',
                [
                    '@collection' => $this->_name,
                    '@id' => $this->_connector->quote($id)
                ]
            );
            $record = $this->_connector->query($select)->fetch();
            if ($record) {
                return json_decode($record['obj']);
            }
        }
        return null;
    }
705725
static function fetchByID( $id ,$asObject = true )
    {
        $cond = array( 'id' => $id );
        return eZPersistentObject::fetchObject( eZNodeAssignment::definition(),
                                                null, $cond,
                                                $asObject );
    }
1057611
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
    {
        if ( $currentVersion != false )
        {
//             $contentObjectAttributeID = $contentObjectAttribute->attribute( "id" );
//             $currentObjectAttribute = eZContentObjectAttribute::fetch( $contentObjectAttributeID,
//                                                                         $currentVersion );
            $dataText = $originalContentObjectAttribute->attribute( "data_text" );
            $contentObjectAttribute->setAttribute( "data_text", $dataText );
        }
        else
        {
            $contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
            $default = $contentClassAttribute->attribute( 'data_text1' );
            if ( $default !== '' && $default !== NULL )
            {
                $contentObjectAttribute->setAttribute( 'data_text', $default );
            }
        }
    }
598259
static function fetchByIdentifier( $identifier, $asObject = true )
    {
        return eZPersistentObject::fetchObject( eZContentObjectAttribute::definition(),
                                                null,
                                                array( 'sort_key_string' => $identifier, 'data_type_string' => 'ezstring' ),
                                                $asObject );
    }
833998
function fetchCollectionAttributeHTTPInput( $collection, $collectionAttribute, $http, $base, $contentObjectAttribute )
    {
        $multioptionValue = $http->postVariable( $base . "_data_multioption_value_" . $contentObjectAttribute->attribute( "id" ) );
        $collectionAttribute->setAttribute( 'data_int', $multioptionValue );
        return true;
    }
210529
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        $classList = $http->postVariable( $base . self::CLASS_LIST_VARIABLE . $contentObjectAttribute->attribute( "id" ), array() );
        $classList = !is_array( $classList ) ? array() : $classList;

        $validClassIdentifiers = array();

        foreach ( $classList as $classIdentifier )
        {
            if ( eZContentClass::exists( $classIdentifier, eZContentClass::VERSION_STATUS_DEFINED, false, true ) )
            {
                $validClassIdentifiers[] = $classIdentifier;
            }
        }

        if ( !empty( $validClassIdentifiers ) )
        {
            $contentObjectAttribute->setAttribute( self::CLASS_LIST_FIELD, implode( ",", $validClassIdentifiers ) );
        }
        else
        {
            $contentObjectAttribute->setAttribute( self::CLASS_LIST_FIELD, "" );
        }

        return true;
    }
382833
static function fetchByObjectId( $contentobjectID, $contentobjectAttributeId = null )
    {
        $cond = array( 'contentobject_id' => $contentobjectID );
        if ( $contentobjectAttributeId !== null )
        {
            $cond['contentobject_attribute_id'] = $contentobjectAttributeId;
        }
        $return = eZPersistentObject::fetchObjectList( self::definition(), null, $cond );
        return $return;
    }
1303989
public function fetch ( $id ) {
        if (isset( self::$propData[$this->getKey( $id )] )) {
            return self::$propData[$this->getKey( $id )];
        }
        return false;
    }
237149
public function fetch($id)
    {
        // Bail out if a non-string was passed.
        if (!is_string($id)) {
            throw Object_Freezer_Util::getInvalidArgumentException(1, 'string');
        }

        // Try to retrieve object from the object cache.
        $object = $this->cache->get($id);

        if (!$object) {
            // Retrieve object from the object storage.
            $frozenObject = $this->doFetch($id);
            $this->fetchArray($frozenObject['objects'][$id]['state']);
            $object = $this->freezer->thaw($frozenObject);

            // Put object into the object cache.
            $this->cache->put($id, $object);
        }

        return $object;
    }
946073
function fetchCollection($class_name = "stdClass")
    {
        /* backward compatibility, you can use object instead of class name */
        if (is_object($class_name)) {
            $class_name = get_class($class_name);
        }

        return $this->fetchAll(DB::FETCH_CLASS, $class_name);
    }
153025
public static function get($params = array())
	{
		$object = new static;
		$data   = $object->request('GET', $object->getUrl(), $params);
		$data   = $object->stripResponseData($data);

		// Initialise a collection
		$collection = self::newCollection();

		if (isset($data[0]) && is_array($data[0])) {
			// This should be a collection
			$collection->setItems($data);
		}

		return $collection;
	}
1251777
function objectAttributeContent( $contentObjectAttribute )
    {
        $paexID = $contentObjectAttribute->attribute( "contentobject_id" );
        $paex = eZPaEx::fetch( $paexID );
        return $paex;
    }
236494
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        $content = $contentObjectAttribute->content();
        // new object creation
        $newObjectPostVariableName = "attribute_" . $contentObjectAttribute->attribute( "id" ) . "_new_object_name";
        if ( $http->hasPostVariable( $newObjectPostVariableName ) )
        {
            $name = $http->postVariable( $newObjectPostVariableName );
            if ( !empty( $name ) )
            {
                $content['new_object'] = $name;
            }
        }
        $singleSelectPostVariableName = "single_select_" . $contentObjectAttribute->attribute( "id" );
        if ( $http->hasPostVariable( $singleSelectPostVariableName ) )
            $content['singleselect'] = true;

        $postVariableName = $base . "_data_object_relation_list_" . $contentObjectAttribute->attribute( "id" );
        $contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
        $classContent = $contentClassAttribute->content();

        $selectedObjectIDArray = $http->hasPostVariable( $postVariableName ) ? $http->postVariable( $postVariableName ) : false;

        // If we got an empty object id list
        if ( ( $selectedObjectIDArray === false && $classContent['selection_type'] != 0 ) || ( isset( $selectedObjectIDArray[0] ) && $selectedObjectIDArray[0] === 'no_relation' ) )
        {
            $content['relation_list'] = array();
            $contentObjectAttribute->setContent( $content );
            $contentObjectAttribute->store();
            return true;
        }
        // Type is browse and we have no http input
        else if ( $selectedObjectIDArray === false )
        {
            return false;
        }

        // Check if selection type is not browse
        if ( $classContent['selection_type'] != 0 )
        {
            $priority = 0;
            $content['relation_list'] = array();
            foreach ( $selectedObjectIDArray as $objectID )
            {
                // Check if the given object ID has a numeric value, if not go to the next object.
                if ( !is_numeric( $objectID ) )
                {
                    eZDebug::writeError( "Related object ID (objectID): '$objectID', is not a numeric value.", __METHOD__ );

                    continue;
                }
                ++$priority;
                $content['relation_list'][] = $this->appendObject( $objectID, $priority, $contentObjectAttribute );
            }

            $contentObjectAttribute->setContent( $content );
            return true;
        }

        $priorities               = array();
        $priorityBase             = $base . '_priority';
        $contentObjectAttributeID = $contentObjectAttribute->attribute( 'id' );
        if ( $http->hasPostVariable( $priorityBase ) )
            $priorities = $http->postVariable( $priorityBase );

        // Add new relations
        if ( $selectedObjectIDArray )
        {
            foreach ( $selectedObjectIDArray as $x => $objectID )
            {
                // Check if the given object ID has a numeric value, if not go to the next object.
                if ( !is_numeric( $objectID ) )
                {
                    eZDebug::writeError( "Related object ID (objectID): '$objectID', is not a numeric value.", __METHOD__ );

                    continue;
                }
                for ( $y = 0, $c = count( $content['relation_list'] ); $y < $c; ++$y )
                {
                    if ( $objectID == $content['relation_list'][$y]['contentobject_id'] )
                    {
                        continue 2;
                    }
                }
                $content['relation_list'][] = $this->appendObject( $objectID, $priorities[$contentObjectAttributeID][$x], $contentObjectAttribute );
            }
        }

        // Indexing priorities by object id
        // and make sure each priority is unique
        $existingPriorities = array();
        $prioritiesByContentObjectId = array();
        foreach ( $selectedObjectIDArray as $k => $id )
        {
            $priority = (int)$priorities[$contentObjectAttributeID][$k];
            while ( isset( $existingPriorities[$priority] ) )
            {
                $priority++;
            }
            $prioritiesByContentObjectId[$id] = $priority;
            $existingPriorities[$priority] = $priority;
        }

        foreach ( $content['relation_list'] as &$relationItem )
        {
            if ( $relationItem['is_modified'] )
            {
                $subObjectID = $relationItem['contentobject_id'];
                $attributeBase = $base . '_ezorl_edit_object_' . $subObjectID;
                $object = $content['temp'][$subObjectID]['object'];
                if ( $object )
                {
                    $attributes = $content['temp'][$subObjectID]['attributes'];

                    $customActionAttributeArray = array();
                    $fetchResult = $object->fetchInput( $attributes, $attributeBase,
                                                        $customActionAttributeArray,
                                                        $contentObjectAttribute->inputParameters() );
                    $content['temp'][$subObjectID]['attribute-input-map'] = $fetchResult['attribute-input-map'];
                    $content['temp'][$subObjectID]['attributes'] = $attributes;
                    $content['temp'][$subObjectID]['object'] = $object;
                }
            }
            $relationItem['priority'] = $prioritiesByContentObjectId[$relationItem['contentobject_id']];
        }

        usort(
            $content['relation_list'],
            function ( $a, $b )
            {
                return $a['priority'] - $b['priority'];
            }
        );
        $p = 1;
        foreach ( $content['relation_list'] as &$relationItem )
        {
            $relationItem['priority'] = $p;
            $p++;
        }

        $contentObjectAttribute->setContent( $content );
        return true;
    }
1246345
static function fetchByContentObjectID( $contentObjectID, $languageCode = null, $asObject = true )
    {
        $condition = array();
        $condition['contentobject_id'] = $contentObjectID;
        $condition['data_type_string'] = 'ezmedia';
        if ( $languageCode != null )
        {
            $condition['language_code'] = $languageCode;
        }
        $custom = array( array( 'operation' => 'DISTINCT id',
                             'name' => 'id' ) );
        $ids = eZPersistentObject::fetchObjectList( eZContentObjectAttribute::definition(),
                                             array(),
                                             $condition,
                                             null,
                                             null,
                                             false,
                                             false,
                                             $custom );
        $mediaFiles = array();
        foreach ( $ids as $id )
        {
            $mediaFileObjectAttribute = eZMedia::fetch( $id['id'], null, $asObject );
            $mediaFiles = array_merge( $mediaFiles, $mediaFileObjectAttribute );
        }
        return $mediaFiles;
    }
1038857
public function getObjectByInfo($info)
       {
            parent::rewind();
            while(parent::valid()) {
                if (parent::getInfo() === $info) {
                    return parent::current();
                }
                parent::next();
            }
       }