/** * Fixes reverse relations * * @see eZObjectRelationListType::fixRelatedObjectItem() * * @param int $objectID * @param string|bool $mode See eZObjectRelationListType::fixRelatedObjectItem() for valid modes */ static function fixReverseRelations( $objectID, $mode = false ) { $db = eZDB::instance(); $objectID = (int) $objectID; // Finds all the attributes that store relations to the given object. $result = $db->arrayQuery( "SELECT attr.* FROM ezcontentobject_link link, ezcontentobject_attribute attr WHERE link.from_contentobject_id=attr.contentobject_id AND link.from_contentobject_version=attr.version AND link.contentclassattribute_id=attr.contentclassattribute_id AND link.to_contentobject_id=$objectID" ); if ( count( $result ) > 0 ) { $objectIDList = array(); foreach( $result as $row ) { $attr = new eZContentObjectAttribute( $row ); $dataType = $attr->dataType(); $dataType->fixRelatedObjectItem( $attr, $objectID, $mode ); $objectIDList[] = $attr->attribute( 'contentobject_id' ); } if ( eZINI::instance()->variable( 'ContentSettings', 'ViewCaching' ) === 'enabled' ) eZContentCacheManager::clearObjectViewCacheArray( $objectIDList ); } }